Error 103 / Q.
#1

Read the last post.
----------------------------
After i do a pickup,like money in single player , after a player pick the thing,to disapear(the pickup) and respawn randomly ?


(rep.)
Reply
#2

To specify the length of a string/array, use square brackets not parenthesis.

pawn Код:
new tmp[256], tmp2[256];
For the pickup thing, read up on pickup types here and pick the one you need. https://sampwiki.blast.hk/wiki/PickupTypes
Reply
#3

pawn Код:
new tmp[256], tmp2[256];
EdIT: So close.
Reply
#4

With
new tmp[256], tmp2[256];
gave me that errors:
: error 029: invalid expression, assumed zero
: warning 215: expression has no effect
: error 001: expected token: ";", but found "]"
: error 029: invalid expression, assumed zero
: fatal error 107: too many error messages on one line

at the same codes:
pawn Код:
if (strcmp("/pay", cmdtext, true) == 0) (
    new tmp[256], tmp2[256];
------
I have ID 8 at Pickup Tips,but how(if is possible) respawns randomly on the map after the pickup was...picked up?
Reply
#5

if (strcmp("/pay", cmdtext, true) == 0) {
new tmp[256], tmp2[256];

I can also tell you you'll never need a string size of 256 I'm guessing those are for messages.
Reply
#6

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
if (strcmp("/pay", cmdtext, true) == 0) {
new tmp[256], tmp2[256];

I can also tell you you'll never need a string size of 256 I'm guessing those are for messages.
More errors,14.
The whole code:
pawn Код:
if (strcmp("/pay", cmdtext, true) == 0) {
    new tmp[256], tmp2[256];
    tmp = strtok(cmdtext, idx);
    tmp2 = strtok(cmdtext, idx);

    if (!strlen(tmp)} {
         SendClientMessage (playerid, COLOR_YELLOW, "Comanda este /pay [playerid] [suma]" ! );
         return 1;
    }
   
    if (!strlen(tmp2)} {
         SendClientMessage (playerid, COLOR_YELLOW, "Comanda este /pay [playerid] [suma]" ! );
         return 1;
    }
   
    new receiver, money;
    receiver = strval(tmp);
    money = strval(tmp2);
   
    if(GetPlayerMoney(playerid) < money){
       SendClientMessage(playerid COLOR_YELLOW, "Nu ai destui bani ! " );
       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), "Ai primit $%d de la %s ",money,playername);
    SendClientMessage (playerid, COLOR_YELLOW, string);
    format(string, sizeof(string), "I-ai dat $%d lui %s ",money,playername2);
    SendClientMessage (playerid, COLOR_YELLOW, string);

    GivePlayerMoney(playerid, (0 - money));
    GivePlayerMoney(receiver, money);
   
    return 1;
}
Reply
#7

Up,i removed something wrong and now i have:
: error 017: undefined symbol "idx"
: error 017: undefined symbol "idx"
: error 001: expected token: ",", but found "-integer value-"
: warning 215: expression has no effect
: warning 215: expression has no effect
: error 001: expected token: ";", but found ")"
: error 029: invalid expression, assumed zero
: fatal error 107: too many error messages on one line

pawn Код:
if (strcmp("/pay", cmdtext, true) == 0) {
    new tmp[256], tmp2[256];
    tmp = strtok(cmdtext, idx);
    tmp2 = strtok(cmdtext, idx);

    if (!strlen(tmp)) {
         SendClientMessage (playerid, COLOR_YELLOW, "Comanda este /pay [playerid] [suma]"  );
         return 1;
    }
   
    if (!strlen(tmp2)) {
         SendClientMessage (playerid, COLOR_YELLOW, "Comanda este /pay [playerid] [suma]"  );
         return 1;
    }
   
    new receiver, money;
    receiver = strval(tmp);
    money = strval(tmp2);
   
    if(GetPlayerMoney(playerid) < money){
       SendClientMessage(playerid COLOR_YELLOW, "Nu ai destui bani ! ");
       return 1;
Sorry for the double-post.
Reply
#8

I modified:
Now i have 4 errors:
: error 017: undefined symbol "cmd"
: error 029: invalid expression, assumed zero
: warning 215: expression has no effect
: error 001: expected token: ";", but found "]"
: fatal error 107: too many error messages on one line

And the code is:
pawn Код:
if(strcmp(cmd, "/pay", true) == 0)
    new tmp[256], tmp2[256];
    tmp = strtok(cmdtext, idx);
    tmp2 = strtok(cmdtext, idx);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)