warnings error help!
#1

How to fix these warnings ?

Code:
C:\Program Files\lvcnrr\gamemodes\LVCNR1.pwn(18365) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Program Files\lvcnrr\gamemodes\LVCNR1.pwn(18426) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Program Files\lvcnrr\gamemodes\LVCNR1.pwn(18487) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Program Files\lvcnrr\gamemodes\LVCNR1.pwn(20070) : warning 203: symbol is never used: "pName"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Warnings.
Reply
#2

Link code
Reply
#3

Quote:
Originally Posted by DanRellex
View Post
Link code
Code:
dcmd_setadmin(playerid,params[])
{
	new string[128];
	new ID;
	new cmdreason;
	if(!IsPlayerName(playerid,"TheOwner")) return SCM(playerid,COLOR_WHITE,"{FF0000}[ERROR]{FFFFFF}You have submitted an invalid command, Type /commands or /cmds to see the server commands");
	if(sscanf(params,"ui",ID,cmdreason))
	{
	    SendClientMessage(playerid,COLOR_WHITE,""COL_USAGE"[SYNTAX] {FFFFFF}/setadmin [PLAYER_ID] [ADMIN_LEVEL]");
	    return 1;
	}
	if(!IsPlayerConnected(ID))
	{
	    format(string,sizeof(string),"{AFAFAF}[Error]: {FFFFFF}Invalid player ID.");
	    SendClientMessage(playerid,COLOR_WHITE,string);
	    return 1;
	}
	if(PLAYERLIST_authed[ID] != 1)
	{
        format(string,sizeof(string),"{AFAFAF}[Error]: {FFFFFF}This player is not logged in.");
	    SendClientMessage(playerid,COLOR_WHITE,string);
	    return 1;
	}
	if(cmdreason > 5)
	{
	    format(string,sizeof(string),"{AFAFAF}[Error]: {FFFFFF}The max admin level is 5.");
	    SendClientMessage(playerid,COLOR_WHITE,string);
	    return 1;
	}
	format(string,sizeof(string),""COL_ADMIN"[ADMIN] {FFFFFF}You have set {AFAFAF}%s(%d){FFFFFF}'s admin level to %d!",PlayerName(ID),ID,cmdreason);
	SendClientMessage(playerid,COLOR_WHITE,string);
	format(string,sizeof(string),""COL_ADMIN"[ADMIN] {FFFFFF}%s(%d) has set your admin level to %d!",PlayerName(playerid),playerid,cmdreason);
	SendClientMessage(ID,COLOR_WHITE,string);
	format(string,sizeof(string),"%s(%d) has set %s(%d)'s admin level to %d",PlayerName(playerid),playerid,PlayerName(ID),ID,cmdreason);
	SendALogMessage(string);
	AdminLevel[ID] =cmdreason;
	IsAod[ID] =0;
	SetPlayerToTeamColour(ID);
	return 1;
}
Reply
#4

Quote:
Originally Posted by aCloudy
View Post
Code:
dcmd_setadmin(playerid,params[])
{
	new string[128];
	new ID;
	new cmdreason;
	if(!IsPlayerName(playerid,"TheOwner")) return SCM(playerid,COLOR_WHITE,"{FF0000}[ERROR]{FFFFFF}You have submitted an invalid command, Type /commands or /cmds to see the server commands");
	if(sscanf(params,"ui",ID,cmdreason))
	{
	    SendClientMessage(playerid,COLOR_WHITE,""COL_USAGE"[SYNTAX] {FFFFFF}/setadmin [PLAYER_ID] [ADMIN_LEVEL]");
	    return 1;
	}
	if(!IsPlayerConnected(ID))
	{
	    format(string,sizeof(string),"{AFAFAF}[Error]: {FFFFFF}Invalid player ID.");
	    SendClientMessage(playerid,COLOR_WHITE,string);
	    return 1;
	}
	if(PLAYERLIST_authed[ID] != 1)
	{
        format(string,sizeof(string),"{AFAFAF}[Error]: {FFFFFF}This player is not logged in.");
	    SendClientMessage(playerid,COLOR_WHITE,string);
	    return 1;
	}
	if(cmdreason > 5)
	{
	    format(string,sizeof(string),"{AFAFAF}[Error]: {FFFFFF}The max admin level is 5.");
	    SendClientMessage(playerid,COLOR_WHITE,string);
	    return 1;
	}
	format(string,sizeof(string),""COL_ADMIN"[ADMIN] {FFFFFF}You have set {AFAFAF}%s(%d){FFFFFF}'s admin level to %d!",PlayerName(ID),ID,cmdreason);
	SendClientMessage(playerid,COLOR_WHITE,string);
	format(string,sizeof(string),""COL_ADMIN"[ADMIN] {FFFFFF}%s(%d) has set your admin level to %d!",PlayerName(playerid),playerid,cmdreason);
	SendClientMessage(ID,COLOR_WHITE,string);
	format(string,sizeof(string),"%s(%d) has set %s(%d)'s admin level to %d",PlayerName(playerid),playerid,PlayerName(ID),ID,cmdreason);
	SendALogMessage(string);
	AdminLevel[ID] =cmdreason;
	IsAod[ID] =0;
	SetPlayerToTeamColour(ID);
	return 1;
}
There is no pName in this code? Are you sure this is the right lines in the script or something?
Reply
#5

Quote:
Originally Posted by DavidSparks
View Post
There is no pName in this code? Are you sure this is the right lines in the script or something?
No, I added " new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName)); " to the command, Then compiled and saw 4 warnings.

Then i removed what i added and compiled and 4 warnings didn't get removed.
Reply
#6

PLEASE Help!!!
Reply
#7

The code you have given has nothing to do with errors, display the correct codes to be able to help him.
Reply
#8

Warnings fixed.
Thanks for everyone posted here

~solved.
Reply


Forum Jump:


Users browsing this thread: