new str[128],Nick[24]; //Here is the error... GetPlayerName(playerid,Nick,24); new Cash = (random(30)+20)*5000; format(str,128,"~b~Player ~r~%s ~b~found hidden package and won ~g~%d$!",Nick,Cash); GameTextForAll(params[(strlen(tmp)+strlen(tmp2)+2)], strval(tmp2), strval(tmp)); GivePlayerMoney(playerid,Cash); DestroyObject(Package); Package=0; }
: error 003: declaration of a local variable must appear in a compound block
: error 017: undefined symbol "str"
: warning 215: expression has no effect
: error 001: expected token: ";", but found "]"
: fatal error 107: too many error messages on one line|
declaration of a local variable must appear in a compound block The declaration of a local variable must appear between braces (“{. . .}”) at the active scope level. When the parser flags this error, a variable declaration appears as the only statement of a function or the only statement below an if, else, for, while or do statement. Note that, since local variables are accessible only from (or below) the scope that their declaration appears in, having a variable |
|
pawn Код:
|
new str[128], Nick[24];
// or
new str[128];
new Nick[24];
// or
new
str[128],
Nick[24];
if(pickupid == Package) new str[128],Nick[24]; GetPlayerName(playerid,Nick,24); new Cash = (random(30)+20)*5000; format(str,128,"~b~Player ~r~%s ~b~found hidden package and won ~g~%d$!",Nick,Cash); GameTextForAll(params[(strlen(tmp)+strlen(tmp2)+2)], strval(tmp2), strval(tmp)); GivePlayerMoney(playerid,Cash); DestroyPickup(Package); Package=0; }
new str[128],Nick[24];
