Help please warning code
#1

I am getting a warning:

Код:
 warning 204: symbol is assigned a value that is never used: "pName"
Full code:

Код:
command(remotewarn, playerid, params[])
{
 	new pName[MAX_PLAYER_NAME], name, reason[128], string[128];
	if(sscanf(params, "ss", name, reason))
	{
	    if(Player[playerid][AdminLevel] >= 5)
	    {
			SendClientMessage(playerid, WHITE, "SYNTAX: /remotewarn [name] [reason]");
		}
	}
	else
	{
	    if(Player[playerid][AdminLevel] >= 5)
	    {
	        //GetPlayerName(name, pName, sizeof(pName));
		    format(string, sizeof(string), "Accounts/%s.ini", GetName(name));

		    if(fexist(string))
		    {
          		if(strfind("Warning1", "None", false))
		        {
		            SendClientMessage(playerid, WHITE, "You can't prison a higher level administrator (or equal to your rank).");
		        }
		        else
		        {
		            SendClientMessage(playerid, WHITE, "dfhgkfjd");
		        }
		    }
		    else
		    {
		        SendClientMessage(playerid, WHITE, "Account not found.");
		    }
	    }
	}
}
Error line:
Код:
new pName[MAX_PLAYER_NAME], name, reason[128], string[128];
Reply
#2

pawn Код:
new name, reason[128], string[128];
although I do not believe that your code will work at all...
your "name" variable should be a string as a string is assigned to it in the sscanf line... and "GetName(name) => getting the name of a string? I'd suggest to leave the "GetName()" and just write "name" into the format line


something like that
pawn Код:
command(remotewarn, playerid, params[])
{
    new name[MAX_PLAYER_NAME], reason[128], string[128];
    if(sscanf(params, "ss", name, reason))
    {
        if(Player[playerid][AdminLevel] >= 5)
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /remotewarn [name] [reason]");
        }
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 5)
        {
            format(string, sizeof(string), "Accounts/%s.ini", name);

            if(fexist(string))
            {
                if(strfind("Warning1", "None", false))
                {
                    SendClientMessage(playerid, WHITE, "You can't prison a higher level administrator (or equal to your rank).");
                }
                else
                {
                    SendClientMessage(playerid, WHITE, "dfhgkfjd");
                }
            }
            else
            {
                SendClientMessage(playerid, WHITE, "Account not found.");
            }
        }
    }
}
Reply
#3

Quote:
Originally Posted by Sascha
Посмотреть сообщение
pawn Код:
new name, reason[128], string[128];
although I do not believe that your code will work at all...
your "name" variable should be a string as a string is assigned to it in the sscanf line... and "GetName(name) => getting the name of a string? I'd suggest to leave the "GetName()" and just write "name" into the format line


something like that
pawn Код:
command(remotewarn, playerid, params[])
{
    new name[MAX_PLAYER_NAME], reason[128], string[128];
    if(sscanf(params, "ss", name, reason))
    {
        if(Player[playerid][AdminLevel] >= 5)
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /remotewarn [name] [reason]");
        }
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 5)
        {
            format(string, sizeof(string), "Accounts/%s.ini", name);

            if(fexist(string))
            {
                if(strfind("Warning1", "None", false))
                {
                    SendClientMessage(playerid, WHITE, "You can't prison a higher level administrator (or equal to your rank).");
                }
                else
                {
                    SendClientMessage(playerid, WHITE, "dfhgkfjd");
                }
            }
            else
            {
                SendClientMessage(playerid, WHITE, "Account not found.");
            }
        }
    }
}
Thanks, I got it working now, I am going to +rep you for the help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)