SA-MP Forums Archive
Wont Work :( - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Wont Work :( (/showthread.php?tid=461515)



Wont Work :( - Giroud12 - 02.09.2013

pawn Код:
CMD:getcookies(playerid, params[])
{
   if(sscanf(params, "u", GiveID)) return SendClientMessage(playerid, RED, "USAGE: /getcookies [ID]");
   {
   if(!IsPlayerConnected(GiveID)) return SendClientMessage(playerid, RED, "ERROR: Player is not connected");
   {
   if(GiveID == playerid) SendClientMessage(playerid, RED, "ERROR: You can check your own cookies using /mycookies");
   {
   new str[256],name2[MAX_PLAYER_NAME];
   format(str, sizeof(str), "Name : %s\n Cookies\n%d", name2, pInfo[GiveID][COOKIES]);
   ShowPlayerDialog(playerid, D_GETCOOKIES, DIALOG_STYLE_MSGBOX, "Cookies Statistic",str,"OK","");
   }
   }
   }
   return 1;
}
When I make /getcookies 10000000000 it show the usage.
What is the problem?


Re: Wont Work :( - Dragonsaurus - 02.09.2013

The "u" specifier is used for IDs. Try with "i" instead.
Edit if you are trying to see someone's cookies, the id should be under the connected players' count.


Re: Wont Work :( - Giroud12 - 02.09.2013

I use it for id


Re: Wont Work :( - Dragonsaurus - 02.09.2013

Then the usage is /getcookies 0 to see your cookies.
@Konstantinos: Is the GiveID a global variable? Conflicts may appear...


Re: Wont Work :( - Giroud12 - 02.09.2013

Its wont work


Re: Wont Work :( - Konstantinos - 02.09.2013

MAX_PLAYERS can be even 1000, but not 10000000000.

By the way, opening braces like that is pointless.
pawn Код:
CMD:getcookies(playerid, params[])
{
    new ID;
    if(sscanf(params, "r", ID)) return SendClientMessage(playerid, RED, "USAGE: /getcookies [Name/ID]");
    if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "ERROR: Player is not connected");
    if(ID == playerid) SendClientMessage(playerid, RED, "ERROR: You can check your own cookies using /mycookies");
    new str[64],name2[MAX_PLAYER_NAME];
    GetPlayerName(ID, name2, MAX_PLAYER_NAME);
    format(str, sizeof(str), "Name : %s\n Cookies\n%d", name2, pInfo[ID][COOKIES]);
    ShowPlayerDialog(playerid, D_GETCOOKIES, DIALOG_STYLE_MSGBOX, "Cookies Statistic",str,"OK","");
    return 1;
}