SA-MP Forums Archive
Restricting a Class - 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)
+--- Thread: Restricting a Class (/showthread.php?tid=368010)



Restricting a Class - Melon - 11.08.2012

Hi, I'm trying to restrict a class so you can only use it if your admin level 100.

This is my code so far:

pawn Код:
else if(GetPlayerSkin(playerid) == 230)
    {
        if(PlayerInfo[playerid][pAdmin] < 100)
        {
            SendClientMessage(playerid, COLOR_GREY,"This is a restricted class!");
            return 1;
        }
        GameTextForPlayer(playerid, "~y~OG Gangsta's", 2000, 3);
        SetPlayerPos(playerid, 1129.0776, -1488.1957, 22.7690);
        SetPlayerFacingAngle(playerid, 0.7288);
        SetPlayerCameraPos(playerid, 1129.1257,-1476.7831,22.7690);
        SetPlayerCameraLookAt(playerid, 1129.0983, -1485.8500, 22.7690);
        SetPlayerVirtualWorld(playerid, 1);
    }
    return 1;
}
I want the player to be able to see the class but when the click 'Spawn' it will send the message.

I also need to do this relating to the FBI and Military w/ If(PlayerInfo[playerid][pKills] >= 200) for example.

Thanks.


Re: Restricting a Class - FalconX - 11.08.2012

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if( GetPlayerSkin( playerid ) == 230 && PlayerInfo[playerid][pAdmin] < 100 )
    {
        SendClientMessage(playerid, COLOR_GREY, "This is a restricted class!" );
        return 0;
    }
    return 1;
}

public OnPlayerSpawn( playerid )
{
    if( GetPlayerSkin( playerid ) == 230 )
    {
        GameTextForPlayer(playerid, "~y~OG Gangsta's", 2000, 3);
        SetPlayerPos(playerid, 1129.0776, -1488.1957, 22.7690);
        SetPlayerFacingAngle(playerid, 0.7288);
        SetPlayerCameraPos(playerid, 1129.1257,-1476.7831,22.7690);
        SetPlayerCameraLookAt(playerid, 1129.0983, -1485.8500, 22.7690);
        SetPlayerVirtualWorld(playerid, 1);
    }
    return 1;
}



Re: Restricting a Class - Melon - 11.08.2012

Quote:
Originally Posted by FalconX
Посмотреть сообщение
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if( GetPlayerSkin( playerid ) == 230 && PlayerInfo[playerid][pAdmin] < 100 )
    {
        SendClientMessage(playerid, COLOR_GREY, "This is a restricted class!" );
        return 0;
    }
    return 1;
}

public OnPlayerSpawn( playerid )
{
    if( GetPlayerSkin( playerid ) == 230 )
    {
        GameTextForPlayer(playerid, "~y~OG Gangsta's", 2000, 3);
        SetPlayerPos(playerid, 1129.0776, -1488.1957, 22.7690);
        SetPlayerFacingAngle(playerid, 0.7288);
        SetPlayerCameraPos(playerid, 1129.1257,-1476.7831,22.7690);
        SetPlayerCameraLookAt(playerid, 1129.0983, -1485.8500, 22.7690);
        SetPlayerVirtualWorld(playerid, 1);
    }
    return 1;
}
Thank you so much, works perfectly.

+Rep'd.

Edit: I see you script for $$. I will be in touch soon.


Re: Restricting a Class - FalconX - 11.08.2012

Quote:
Originally Posted by Melon
Посмотреть сообщение
Thank you so much, works perfectly.

+Rep'd.

Edit: I see you script for $$. I will be in touch soon.
No problem mate, and yes I script for $$