SA-MP Forums Archive
Command: "Symbol is never used" - 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: Command: "Symbol is never used" (/showthread.php?tid=482273)



Command: "Symbol is never used" - [WA]iRonan - 20.12.2013

Код:
C:\Documents and Settings\Administrator\Bureaublad\RPG\gamemodes\rc-apo.pwn(1440) : warning 203: symbol is never used: "setlevel"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
This warning appears when I compile, and now I can't use this command.

Код:
CMD:setlevel(playerid, params[])
{
	if(!strcmp(cmdtext, "/setlevel", true))
	{
		if(IsPlayerAdmin(playerid))
		{
			new id,level,string[128],aName[MAX_PLAYER_NAME];
			if(sscanf(params,"ud",id,level)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /setlevel [id/name] [level]");
			else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "Invalid player id.");
			else if(level > 5) SendClientMessage(playerid, COLOR_RED, "You can't give a player a higher admin level than 5!");
			else
			{
				pStats[id][admin] = 5;
				new INI:file = INI_Open(Path(id));
				INI_WriteInt(file,"Admin",level);
				INI_Close(file);
				GetPlayerName(playerid, aName, sizeof(aName));
				format(string, sizeof(string), "Admin %s has set your admin level to %d.",aName,level);
				SendClientMessage(playerid, COLOR_WHITE, "You have changed the selected user's admin level.");
				SendClientMessage(id,COLOR_GREEN,string);
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_RED, "[!] You need to be a higher admin level to use this command.");
		}
        return 1;
    }
Please note, that #pragma unused setlevel, doesn't work.

For whoever helps, thank you


Re: Command: "Symbol is never used" - Konstantinos - 20.12.2013

pawn Код:
#include <a_samp>
#include <zcmd>

// ...

CMD:setlevel(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "[!] You need to be a higher admin level to use this command.");
    new id, level;
    if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /setlevel [id/name] [level]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Invalid player id.");
    if(level > 5) SendClientMessage(playerid, COLOR_RED, "You can't give a player a higher admin level than 5!");
    pStats[id][admin] = 5;
    new string[62], INI:file = INI_Open(Path(id));
    INI_WriteInt(file, "Admin", level);
    INI_Close(file);
    GetPlayerName(playerid, string, MAX_PLAYER_NAME);
    SendClientMessage(playerid, COLOR_WHITE, "You have changed the selected user's admin level.");
    format(string, sizeof(string), "Admin %s has set your admin level to %d.",string,level);
    SendClientMessage(id,COLOR_GREEN,string);
    return 1;
}



Re: Command: "Symbol is never used" - [WA]iRonan - 20.12.2013

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
#include <a_samp>
#include <zcmd>

// ...

CMD:setlevel(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "[!] You need to be a higher admin level to use this command.");
    new id, level;
    if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /setlevel [id/name] [level]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Invalid player id.");
    if(level > 5) SendClientMessage(playerid, COLOR_RED, "You can't give a player a higher admin level than 5!");
    pStats[id][admin] = 5;
    new string[62], INI:file = INI_Open(Path(id));
    INI_WriteInt(file, "Admin", level);
    INI_Close(file);
    GetPlayerName(playerid, string, MAX_PLAYER_NAME);
    SendClientMessage(playerid, COLOR_WHITE, "You have changed the selected user's admin level.");
    format(string, sizeof(string), "Admin %s has set your admin level to %d.",string,level);
    SendClientMessage(id,COLOR_GREEN,string);
    return 1;
}
Still "Symbol is not used"


Re: Command: "Symbol is never used" - Konstantinos - 20.12.2013

That warning is shown when you don't include zcmd to the mode so make sure again that there's:
pawn Код:
#include <zcmd>
before the command.


Re: Command: "Symbol is never used" - [WA]iRonan - 20.12.2013

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
That warning is shown when you don't include zcmd to the mode so make sure again that there's:
pawn Код:
#include <zcmd>
before the command.
Very bad mistake from me, sorry for wasting your time :P. Thanks