SA-MP Forums Archive
[SOLVED] Admin Only 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: [SOLVED] Admin Only Skin (/showthread.php?tid=69038)



[SOLVED] Admin Only Skin - Alec24 - 15.03.2009

I have some code so that only admins can use a certain skin, but there are errors.

Код:
public OnPlayerSpawn(playerid)
{
if(GetPlayerSkin(playerid) == 217);
	{
	if(IsPlayerAdmin(playerid));
	{
	SetPlayerPos(playerid, -1556.5498,-2737.5132,48.7435);
	GameTextForPlayer(playerid, "Spawned At Gas Station.",5000,5);
    GivePlayerMoney(playerid, 500);
	SendClientMessage(playerid, COLOUR_LIGHTBLUE, "Alec's Freeroam Server : Type /help For Help And Commands!");
	SendClientMessage(playerid, COLOUR_LIGHTBLUE, "Money");
	}
	else
	{
	SendClientMessage(playerid, COLOUR_YELLOW,"***ONLY ADMINS MAY USE THIS SKIN, PLEASE CHOOSE AGAIN***");	
    ForceClassSelection(playerid);
	SetPlayerHealth(playerid,0.0);
	return 1;
	}
	}
}
Errors
Код:
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\pawno\include\vehicles.inc(530) : warning 204: symbol is assigned a value that is never used: "colors"
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\Freeroam.pwn(683) : error 036: empty statement
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\Freeroam.pwn(684) : warning 217: loose indentation
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\Freeroam.pwn(685) : error 036: empty statement
C:\Program Files\Rockstar Games\GTA San Andreas\SAMP\Server\gamemodes\Freeroam.pwn(693) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Lines
683,684,685
Код:
if(GetPlayerSkin(playerid) == 217);
	{
	if(IsPlayerAdmin(playerid));
Line 693 is 'else'


Re: Admin Only Skin - Pyrokid - 15.03.2009

Um, you're not supposed to have semicolons after if statements.

Try this:
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(GetPlayerSkin(playerid) == 217)
    {
        if(IsPlayerAdmin(playerid))
        {
            SetPlayerPos(playerid, -1556.5498,-2737.5132,48.7435);
            GameTextForPlayer(playerid, "Spawned At Gas Station.",5000,5);
        GivePlayerMoney(playerid, 500);
            SendClientMessage(playerid, COLOUR_LIGHTBLUE, "Alec's Freeroam Server : Type /help For Help And Commands!");
            SendClientMessage(playerid, COLOUR_LIGHTBLUE, "Money");
        } else {
            SendClientMessage(playerid, COLOUR_YELLOW,"***ONLY ADMINS MAY USE THIS SKIN, PLEASE CHOOSE AGAIN***");
            SetPlayerHealth(playerid,0.0);
            ForceClassSelection(playerid);
        }
    }
    return 1;
}



Re: Admin Only Skin - Alec24 - 15.03.2009

Works fine thanks


Re: Admin Only Skin - MrRieTzzz - 10.08.2009

Tried the same , but I got millions of errors


Re: [SOLVED] Admin Only Skin - Wiliam - 10.08.2010

C:\Users\Jake\Desktop\[Si]StuntServer\gamemodes\SE.pwn(801) : error 021: symbol already defined: "OnPlayerSpawn" lol


Re: Admin Only Skin - Wiliam - 10.08.2010

Quote:
Originally Posted by Pyrokid
Посмотреть сообщение
Um, you're not supposed to have semicolons after if statements.

Try this:
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(GetPlayerSkin(playerid) == 217)
    {
        if(IsPlayerAdmin(playerid))
        {
            SetPlayerPos(playerid, -1556.5498,-2737.5132,48.7435);
            GameTextForPlayer(playerid, "Spawned At Gas Station.",5000,5);
        GivePlayerMoney(playerid, 500);
            SendClientMessage(playerid, COLOUR_LIGHTBLUE, "Alec's Freeroam Server : Type /help For Help And Commands!");
            SendClientMessage(playerid, COLOUR_LIGHTBLUE, "Money");
        } else {
            SendClientMessage(playerid, COLOUR_YELLOW,"***ONLY ADMINS MAY USE THIS SKIN, PLEASE CHOOSE AGAIN***");
            SetPlayerHealth(playerid,0.0);
            ForceClassSelection(playerid);
        }
    }
    return 1;
}
lol fail it's
COLOR not COLOUR fix it pls