Issue with TMP
#1

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?
Reply
#2

can you show the error
Reply
#3

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.
Reply
#4

you have allready define tmp ans tmp2 i thing
Reply
#5

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;
   }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)