Easy Class Selection. -
Elysian` - 24.04.2012
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?

)
Re: Easy Class Selection. -
Hoss - 24.04.2012
Hmm,I've got one question:
- What's point af adding team at Request Class? :\
Add team at player spawn
Re: Easy Class Selection. -
Nєχυѕ - 24.04.2012
How to get CameraPos? and CameraLookAt?
Re: Easy Class Selection. -
Elysian` - 24.04.2012
Quote:
Originally Posted by Hoss
Hmm,I've got one question:
- What's point af adding team at Request Class? :\
Add team at player spawn 
|
What do you mean? You do not have to use teams if you do not wish too..
Quote:
Originally Posted by Nєχυѕ
How to get CameraPos? and CameraLookAt?
|
Say if you took the coords standing infront of the Los Santos police station..
You use /save again infront of the player facing the Police Station. If you know what I mean?
Re: Easy Class Selection. -
Nєχυѕ - 24.04.2012
Quote:
Originally Posted by Windows32
What do you mean? You do not have to use teams if you do not wish too..
Say if you took the coords standing infront of the Los Santos police station..
You use /save again infront of the player facing the Police Station. If you know what I mean?
|
You kidding me? Man , that gives the x,y,z coords.
Re: Easy Class Selection. -
Elysian` - 24.04.2012
Yes I know that, it will tell the camera what coords to look at, hence CameraLookAt.
Re: Easy Class Selection. -
MP2 - 24.04.2012
https://sampforum.blast.hk/showthread.php?tid=57018
See 'assumptions'.
Re: Easy Class Selection. -
Elysian` - 24.04.2012
What's that about?
Re: Easy Class Selection. -
sanplayer - 26.04.2012
C:\Users\Ghost\Desktop\Unique Freeroam\gamemodes\freeroam.pwn(144) : error 033: array must be indexed (variable "Team")
C:\Users\Ghost\Desktop\Unique Freeroam\gamemodes\freeroam.pwn(153) : error 033: array must be indexed (variable "Team")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
Re: Easy Class Selection. -
Elysian` - 26.04.2012
Add "Team" in your enum.