11.05.2009, 19:48
I have this warning:
This line (277) :
From this code:
When I remove it, the warning stops to appear, but if I remove it, something will stop to function?
That's my question, cuz I can't test it.
Код:
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\WHRP.pwn(277) : warning 219: local variable "tmp" shadows a variable at a preceding level Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Warning.
Код:
new tmp[256];
pawn Код:
if(strcmp(cmd, "/givecash", true) == 0) {
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "[SERVER] USAGE: /givecash [Playerid] [Amount]");
return 1;
}
giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "[SERVER] USAGE: /givecash [Playerid] [Amount]");
return 1;
}
moneys = strval(tmp);
//printf("givecash_command: %d %d",giveplayerid,moneys);
if (IsPlayerConnected(giveplayerid)) {
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney = GetPlayerMoney(playerid);
if (moneys > 0 && playermoney >= moneys) {
GivePlayerMoney(playerid, (0 - moneys));
GivePlayerMoney(giveplayerid, moneys);
format(string, sizeof(string), "[SERVER] You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "[SERVER] You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
printf("[SERVER] %s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
}
else {
SendClientMessage(playerid, COLOR_YELLOW, "[SERVER] Invalid transaction amount.");
}
}
else
{
format(string, sizeof(string), "[SERVER] %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}
That's my question, cuz I can't test it.