SA-MP Forums Archive
warnings error help! - 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: warnings error help! (/showthread.php?tid=555409)



warnings error help! - aCloudy - 07.01.2015

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.



Re: warnings error help! - DanRellex - 07.01.2015

Link code


Re: warnings error help! - aCloudy - 07.01.2015

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;
}



Re: warnings error help! - DavidSparks - 07.01.2015

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?


Re: warnings error help! - aCloudy - 07.01.2015

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.


Re: warnings error help! - aCloudy - 07.01.2015

PLEASE Help!!!


Respuesta: warnings error help! - JuanStone - 07.01.2015

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


Re: warnings error help! - aCloudy - 07.01.2015

Warnings fixed.
Thanks for everyone posted here

~solved.