[SOLVED] Admin Only Skin
#1

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'
Reply
#2

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;
}
Reply
#3

Works fine thanks
Reply
#4

Tried the same , but I got millions of errors
Reply
#5

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)