[Tutorial] Easy Class Selection.
#1

Easy Class Selection!
Hello,
Today I will teach you how to make easy class selections in a few steps!


Let's get started:
First of all,
You want to use the AddPlayerClass function.

Код:
AddPlayerClass(288,2296.5662,2451.6270,10.8203,87.8270,0,0,0,0,0,0);
(This will spawn a Police officer on those coords with no weapons. You may use my one if you wish.)


After adding your classes you move on to OnPlayerRequestClass. We will be using (switch).
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    switch(classid) // switch between the classid's displayed in OnGameModeInit.
    {
        case 0, 1: // The number of classes that use this function.
        {
            //Police Spawn
            SetPlayerPos(playerid, 2296.5662,2451.6270, 10.8203); //this is the players position
            SetPlayerFacingAngle(playerid, 87.8270); //their facing angle
           
            //Camera Position Police
            SetPlayerCameraPos(playerid, 2293.3640,2451.7341,12.8203); //this is the cameras position FACING your skin.
           
            //Police Spawn
            SetPlayerCameraLookAt(playerid, 2296.5662,2451.6270, 10.8203); //this is what the camera will look at
           
            PlayerInfo[playerid][Team] = Cops; // if you use a team, This will set them to Team "cops"
        }
        case 2, 3:
        {
            SetPlayerPos(playerid, 2516.9578,2447.6992,11.0313); //this is the players position
            SetPlayerFacingAngle(playerid, 269.7719); //their facing angle
            SetPlayerCameraPos(playerid, 2521.2405,2447.5195,12.0313); //this is the cameras position

            SetPlayerCameraLookAt(playerid, 2516.9578,2447.6992,11.0313); //this is what the camera will look at
            PlayerInfo[playerid][Team] = Civilian;
        }
    }
    return 1;
}
Last but not least, to force a player class selection after connecting, add this under OnPlayerConnect:
pawn Код:
ForceClassSelection(playerid);
Hope this helps you.
(First tutorial, no hate?)
Reply


Messages In This Thread
Easy Class Selection. - by Elysian` - 24.04.2012, 15:30
Re: Easy Class Selection. - by Hoss - 24.04.2012, 15:48
Re: Easy Class Selection. - by Nєχυѕ - 24.04.2012, 15:49
Re: Easy Class Selection. - by Elysian` - 24.04.2012, 15:52
Re: Easy Class Selection. - by Nєχυѕ - 24.04.2012, 16:53
Re: Easy Class Selection. - by Elysian` - 24.04.2012, 17:00
Re: Easy Class Selection. - by MP2 - 24.04.2012, 17:52
Re: Easy Class Selection. - by Elysian` - 24.04.2012, 18:17
Re: Easy Class Selection. - by sanplayer - 26.04.2012, 12:48
Re: Easy Class Selection. - by Elysian` - 26.04.2012, 17:00

Forum Jump:


Users browsing this thread: 1 Guest(s)