Advertisements warning - help -
FL3GM4 - 18.12.2012
Код:
C:\Users\toni\Desktop\Gang War Los Santos 0.3e\gamemodes\mod.pwn(1511) : warning 219: local variable "PlayerName" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.
command:
Код:
CMD:ad(playerid, params[])
{
new string[128], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
new item[ 66 ], Price, PH;
if(sscanf(params, "s[65]dd",item, Price, PH)) return SendClientMessage(playerid, -1, "Usage: /ad [Item] [Price] [Phone Number]");
format(string, sizeof(string), "Selling %s for %d$ (Phone Number: %d) %s", item, Price, PH, PlayerName);
SendClientMessageToAll(-1,string);
return 1;
}
Re: Advertisements warning - help -
Mike_Peterson - 18.12.2012
This is your 5th thread today already, and this warning was shown in your previous thread, I believe.
new string[128], PlayerName[MAX_PLAYER_NAME]; -> new string[128];
Re: Advertisements warning - help -
FL3GM4 - 18.12.2012
when i removed
PlayerName[MAX_PLAYER_NAME]
errors:
Код:
C:\Users\toni\Desktop\Gang War Los Santos 0.3e\gamemodes\mod.pwn(1512) : error 076: syntax error in the expression, or invalid function call
C:\Users\toni\Desktop\Gang War Los Santos 0.3e\gamemodes\mod.pwn(1512) : error 072: "sizeof" operator is invalid on "function" symbols
C:\Users\toni\Desktop\Gang War Los Santos 0.3e\gamemodes\mod.pwn(1515) : error 076: syntax error in the expression, or invalid function call
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
3 Errors.
Re: Advertisements warning - help -
Mike_Peterson - 18.12.2012
well get rid of line 1512, but what I actually think is that you have a PlayerName(playerid); function, or just a double playername variable, find it and use it instead of the variable.."
EDIT: easy way
pawn Код:
CMD:ad(playerid, params[])
{
new string[128], PlayerName123[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName123, sizeof(PlayerName123));
new item[ 66 ], Price, PH;
if(sscanf(params, "s[65]dd",item, Price, PH)) return SendClientMessage(playerid, -1, "Usage: /ad [Item] [Price] [Phone Number]");
format(string, sizeof(string), "Selling %s for %d$ (Phone Number: %d) %s", item, Price, PH, PlayerName123);
SendClientMessageToAll(-1,string);
return 1;
}
Re: Advertisements warning - help -
FL3GM4 - 18.12.2012
well...if i understand you right, i tried to find
PlayerName(playerid); but i dont have this anywhere in my gamemode
line 1512:
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));