Please Help Me, Admin skin - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Please Help Me, Admin skin (
/showthread.php?tid=266500)
Please Help Me, Admin skin -
HayZatic - 05.07.2011
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
Re: Please Help Me, Admin skin -
Bakr - 05.07.2011
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.
Re: Please Help Me, Admin skin -
=WoR=Varth - 05.07.2011
Or this:
pawn Код:
if(GetPlayerSkin(playerid) == 117);
Re: Please Help Me, Admin skin -
Bakr - 05.07.2011
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.