SA-MP Forums Archive
little warning - 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: little warning (/showthread.php?tid=321288)



little warning - mitchboy - 26.02.2012

Hi, this is the warning:
Код:
C:\Users\Mitchell\Desktop\server\gamemodes\SumoGM.pwn(1604) : warning 219: local variable "string" shadows a variable at a preceding level
And here is the part with the problem:
pawn Код:
if(cars[playerid]>0){
    new string[128];//1604
    cars[playerid]--;
    format(string,sizeof(string),"It worked! You still have %i cars left!",cars[playerid]);
    SendClientMessage(playerid,COLOR_LIGHTGREEN,string);}



Re: little warning - coole210 - 26.02.2012

Remove

pawn Код:
new string[128];
It is already defined somewhere in your script.

OR

You can change the name of string.

pawn Код:
if(cars[playerid]>0){
    new string2[128];//1604
    cars[playerid]--;
    format(string2,sizeof(string2),"It worked! You still have %i cars left!",cars[playerid]);
    SendClientMessage(playerid,COLOR_LIGHTGREEN,string2);}



Re: little warning - mitchboy - 26.02.2012

thnx