#1

Hello again,anybody can tell me what's wrong here please?:
pawn Код:
if (strcmp(cmd, "/pay", true) == 0) {      //1386 = Error 1
            new tmp[256], tmp2[256];
            tmp = strtok(cmdtext, idx);      //1388 = Error 2
            tmp2 = strtok(cmdtext, idx);    //1389 = Error 3
           
            if(!strlen(tmp)} {                   //1391 = Error 4 & 5
               SendClientMessage(playerid, COLOR_YELLOW, "Usage: /pay [playerid] [amount]");
               return 1;
            }
           
            if(!strlen(tmp2)} {                  //1396 = Error 5 & Error 6 & Warning 1
               SendClientMessage(playerid, COLOR_YELLOW, "Usage: /pay [playerid] [amount]");
               return 1;
            }
           
            new receiver, money;             //1401 = Warning 2
            receiver = strval(tmp);
            money = strval(tmp2);
           
            if(GetPlayerMoney(playerid) < money) {
                SendClientMessage(playerid, COLOR_YELLOW, "You don't have enough money !");
                return 1;
            }
           
            new string[128];
            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 receive $%d from %s.", money, playername);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            format(string, sizeof(string), "You give $%d to %s.", money, playername2);
            SendClientMessage(playerid, COLOR_YELLOW, string);
           
            GivePlayerMoney(playerid, (0 - money));
            GivePlayerMoney(receiver, money);
           
            return 1;
}
When i compile,i receive 7 errors:
(1386) : error 017: undefined symbol "cmd"
(1388 ) : error 017: undefined symbol "idx"
(1389) : error 017: undefined symbol "idx"
(1391) : error 001: expected token: ")", but found "}"
(1391) : error 029: invalid expression, assumed zero
(1396) : warning 225: unreachable code
(1396) : error 001: expected token: ")", but found "}"
(1396) : error 029: invalid expression, assumed zero
(1401) : warning 225: unreachable code

I marked on pawn the lines.
Reply
#2

1st that cmd isnt a variable there the callback sends the paramter with the name of cmdtext
and there are more variables used in the command......
you copied it i guess and you dont know what is oop so go to wiki.sa-mp.com and read it
Reply
#3

and
if(!strlen(tmp)}
has to be this
if(!strlen(tmp))
and the last two errors have the same problem
Reply
#4

Quote:
Originally Posted by Abhishek.
Посмотреть сообщение
1st that cmd isnt a variable there the callback sends the paramter with the name of cmdtext
and there are more variables used in the command......
you copied it i guess and you dont know what is oop so go to wiki.sa-mp.com and read it
Immediatly i do the thread,i adjusted something and now i have just 2 errors,undefined symbol idx at 1338 and 1339 .

@Yeah,i figure and adjusted,now i have the idx problem..
Reply
#5

you dont have a variable named idx well tell me why are you needing it?
create a new variable named idx by
new idx; but use it correctly or the command may not work
Reply
#6

Thank you,i solved
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)