SA-MP Forums Archive
Issue with TMP - 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: Issue with TMP (/showthread.php?tid=328349)



Issue with TMP - MrBorsh - 24.03.2012

Hi I got a issue with the first line in this pawn code.

pawn Код:
new tmp[256], tmp2[256];
It gives me error in the tmp for some sort of a reason. I am scripting a /givecash command, but I only get error on this first pawn code. Any help?


Re: Issue with TMP - Shabi RoxX - 24.03.2012

can you show the error


Re: Issue with TMP - MrBorsh - 24.03.2012

Quote:
Originally Posted by Shabi RoxX
Посмотреть сообщение
can you show the error
: error 003: declaration of a local variable must appear in a compound block
: error 017: undefined symbol "tmp"
: warning 215: expression has no effect
: error 001: expected token: ";", but found "]"
: fatal error 107: too many error messages on one line

4 Errors.


Re: Issue with TMP - Shabi RoxX - 24.03.2012

you have allready define tmp ans tmp2 i thing


Re: Issue with TMP - MrBorsh - 24.03.2012

Quote:
Originally Posted by Shabi RoxX
Посмотреть сообщение
you have allready define tmp ans tmp2 i thing
Nope this is the full line in an empty pawn script.

pawn Код:
if (strcmp("/send", cmdtext, true, 5) == 0)
    new tmp[256], tmp2[256];
    tmp - strtok(cmdtext, idx);
    tmp2 - strtok(cmdtext, idx);
   
    if (!strlen(tmp)) {
         SendClientMessage(playerid, 0x666666FF, "Usage: /send [ID] [ammount]");
         return 1;
    }
   
    if (!strlen(tmp2)) {
         SendClientMessage(playerid, 0x666666FF, "Usage: /send [ID] [ammount]");
         return 1;
    }

    new receiver, money;
    receiver = strval(tmp);
    money = strval(tmp2);
   
    if (GetPlayerMoney(playerid) < money) {
         SendClientMessage(playerid, 0xFFFFFFFF, "The ammount you typed in is higher than you have."
         return 1;
   }
   
   new string[126];
   new playername[MAX_PLAYER_NAME];
   GetPlayerName(playerid, playername, sizeof(playername));
   new playername2[MAX_PLAYER_NAME];
   GetPlayerName(receiver, playername2, sizeof(playername2));
   
   format(string, sizeof(string), "You received $%d from %s", money, playername);
   SendClientMessage(playerid, 0x666666FF, string);
   format(string, sizeof(string), "You gave $%d to %s", money, playername2);
   SendClientMessage(playerid, 0x666666FF, string));
   
   GivePlayerMoney(0 - money));
   GivePlayerMoney(receiver, money);
   
   return 1;
   }