Jump to content
  • 0

Salut


Wreeper

Question

Cum pot face si eu o comanda de kick/ban, dar fara sscanf?

SSCANF-ul imi da erori multe la compilare,dar cand il scot, dispar toate eroriile si warning-uriile.

 

 

C:\Users\Wreeper\Desktop\sal\pawno\include\sscanf2.inc(258) : warning 202: number of arguments does not match definition
C:\Users\Wreeper\Desktop\sal\pawno\include\sscanf2.inc(271) : error 025: function heading differs from prototype
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
 

258:         new string[128];

De la: public OnPlayerPickUpPickup(playerid, pickupid)

271: public OnPlayerSpawn(playerid)

De la: public OnPlayerSpawn(playerid)

 

Din moment ce-mi da eroriile astea, daca bag o comanda de kick /ban cu sscanf, imi fac iar un amic

 

 

CMD:kick(playerid, params[])
{
    new targetid, string[256], reason[128], playeridn[MAX_PLAYER_NAME], targetidn[MAX_PLAYER_NAME];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, SOME_COLOR,"ERROR: You are not an administrator");
    if(sscanf(params,"is", targetid, reason)) return SendClientMessage(playerid, SOME_COLOR,"USAGE: /kick [targetid] [reason]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, SOME_COLOR,"ERROR: Invalid targetid.");
    if(IsPlayerAdmin(targetid)) return SendClientMessage(playerid, SOME_COLOR,"ERROR: You can't kick an administrator.");
    GetPlayerName(playerid, playeridn, sizeof(playeridn));
    GetPlayerName(targetid, targetidn, sizeof(targetidn));
    format(string, sizeof(string),"Warning: %s has kicked %s from the server, reason: %s", playeridn, targetidn, reason);
    SendClientMessageToAll(SOME_COLOR, string);
    Kick(targetid);
    return 1;
}

 

C:\Users\Wreeper\Desktop\sal\gamemodes\localhost.pwn(970) : error 017: undefined symbol "SOME_COLOR"
C:\Users\Wreeper\Desktop\sal\gamemodes\localhost.pwn(971) : error 017: undefined symbol "SOME_COLOR"
C:\Users\Wreeper\Desktop\sal\gamemodes\localhost.pwn(972) : error 017: undefined symbol "SOME_COLOR"
C:\Users\Wreeper\Desktop\sal\gamemodes\localhost.pwn(973) : error 017: undefined symbol "SOME_COLOR"
C:\Users\Wreeper\Desktop\sal\gamemodes\localhost.pwn(975) : error 029: invalid expression, assumed zero
C:\Users\Wreeper\Desktop\sal\gamemodes\localhost.pwn(977) : error 017: undefined symbol "SOME_COLOR"
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


6 Errors.

 

(ignorati eroriile de tip undefined symbol, trebuie sa-i dau define la culoare)

 

nu prea cred ca mai trebuie sa zic si de cealalta eroare, apare si ea(defapt eroriile sunt amicii)

 

Se poate face fara SSCANF sau , daca nu, cum rezolv?
 

Edited by Wreeper
help.
Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

incearca acu

if(sscanf(params,"is[128]", targetid, reason))
Citat
Link to comment
Share on other sites

  • 0

Daca sscanf iti produce acele erori/warning inseamna ca ai probleme in gm

https://github.com/maddinat0r/sscanf/releases

http://files.sa-mp.com/samp037_svr_R2-1-1_win32.zip

Descarca ultima versiune de sscanf si inlocuieste toate includeurile pe care le ai tu in folderul pawno>includes cu cele descarcate din arhiva de la samp

De asemenea asigura-te ca nu ai nici o functie sscanf in gm(gm-urile vechi au o versiune antica de sscanf inclusa direct in gm)

Link to comment
Share on other sites

  • 0
CMD:kick(playerid, params[])
{
    new targetid, string[256], reason[128];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "ERROR: You are not an administrator");
    if(sscanf(params,"is", targetid, reason)) return SendClientMessage(playerid, -1,"USAGE: /kick [targetid] [reason]");
    
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "ERROR: Invalid targetid.");
    if(IsPlayerAdmin(targetid)) return SendClientMessage(playerid, -1, "ERROR: You can't kick an administrator.");
    
    format(string, sizeof(string),"Warning: %s has kicked %s from the server, reason: %s", GetNameEx(playerid), GetNameEx(targetid), reason);
    SendClientMessageToAll(-1, string);
    Kick(targetid);
    return 1;
}
	
stock GetNameEx(playerid)
{
    new name[MAX_PLAYER_NAME];
    format(name, sizeof(name), "Unknown");
    if(playerid != INVALID_PLAYER_ID) GetPlayerName(playerid, name, sizeof(name));
    return name;
}
Edited by MiritaXD
Link to comment
Share on other sites

  • 0
21 hours ago, Banditul said:

Daca sscanf iti produce acele erori/warning inseamna ca ai probleme in gm

https://github.com/maddinat0r/sscanf/releases

http://files.sa-mp.com/samp037_svr_R2-1-1_win32.zip

Descarca ultima versiune de sscanf si inlocuieste toate includeurile pe care le ai tu in folderul pawno>includes cu cele descarcate din arhiva de la samp

De asemenea asigura-te ca nu ai nici o functie sscanf in gm(gm-urile vechi au o versiune antica de sscanf inclusa direct in gm)

am ultima versiune, nu e nicio functie sscanf in gm ca e facut de la 0

Link to comment
Share on other sites

  • 0

TOT IAU EROARE PE PRIMA FUNCTIE, INDIFERENT CARE O FI AIA, DE LA SSCANF

 

public OnPlayerSpawn(playerid) {
GivePlayerMoney(playerid, 5000);
GivePlayerWeapon(playerid,WEAPON_SILENCED,1483);
// GivePlayerWeapon(playerid,WEAPON_COLT45,100);
SetPlayerTime(playerid, 0, 0);
SetPlayerColor(playerid, 0xFFFFFFFF);
return 1;
}

 

C:\Users\Wreeper\Desktop\sal\pawno\include\sscanf2.inc(271) : error 025: function heading differs from prototype

 

 

HELP

 

 

C:\Users\Wreeper\Desktop\sal\pawno\include\sscanf2.inc(258) : warning 202: number of arguments does not match definition

public OnPlayerPickUpPickup(playerid, pickupid) {
if(pickupid == pickup_Wreeper) {
GivePlayerMoney(playerid, 100000);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
GivePlayerWeapon(playerid, WEAPON_COLT45, 15);
new string[128];
format(string, sizeof(string), "%s a gasit pickup-ul si a castigat 100.000$, armura, viata full, si un Colt45 cu 15 gloante.", GetName(playerid));
SendClientMessage(playerid, 0xFFFF00FF, string);
}
return 1;
}

 

help si aici...

Link to comment
Share on other sites

  • 0

vezi daca ai deja functia sscanf intr-un include sau in gm si sterge-o si lasa include-ul si plugin-ul sscanf ca e mai bun

Citat
Link to comment
Share on other sites

  • 0
Acum 5 ore, Wreeper a spus:

am ultima versiune, nu e nicio functie sscanf in gm ca e facut de la 0

Problema e faptul ca nici una din funtiile oferite de tine nu sunt linile la care primesti erori. In tot include sscanf2.inc nu e nici un OnPlayerSpawn sau OnPlayerPickUpPickup

Edit: Problema ta e legata de OnPlayerDisconnect (asta daca linile cu erorile corespund cu ultima versiune a sscanf)

Edited by Banditul
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.