Please Help Me, Admin skin
#1

Okay Well Heres My Admin SKins Script.That is getting the Error.

Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetupPlayerForClassSelection(playerid);
    new classid = GetPlayerSkin(playerid);
    if(classid == 117)
{
    if(IsPlayerAdmin(playerid))
    {
        return 1;
        SendClientMessage(playerid, RED, "Welcome Admin");
    }
    else
    {
        GameTextForPlayer(playerid, "You aren't an admin!", 5000, 5);
        return 0;
    }
}
    return 1;
And here are the errors

Код:
C:\Documents and Settings\Chris\My Documents\HayZaticFreeRoam\gamemodes\FreeRoam.pwn(383) : warning 219: local variable "classid" shadows a variable at a preceding level
C:\Documents and Settings\Chris\My Documents\HayZaticFreeRoam\gamemodes\FreeRoam.pwn(389) : warning 225: unreachable code
Reply
#2

You need to change the variable that you create within the public to another name, since there is already a variable called 'classid' for the public.
pawn Код:
new skin = GetPlayerSkin(playerid);
    if(skin == 117)
Also, to remove the unreachable code warning, you need to remove the returns inside of the if and else statements. You do not need them, as either way, it returns, making the code unable to reach the next step in the callback.
Reply
#3

Or this:
pawn Код:
if(GetPlayerSkin(playerid) == 117);
Reply
#4

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
Or this:
pawn Код:
if(GetPlayerSkin(playerid) == 117);
Remove the semi-colon at the end of the statement, and yes, that would work. Also remove the creation of an unecessary variable.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)