12.06.2011, 02:42
It depends on the order of which you added the characters (AddPlayerClass lines) to the script. For example, if the Army is your first AddPlayerClass line, you could use the following code:
A couple notable links to look at:
OnPlayerRequestClass callback - This function is called when the player enters class selection and each time they press a button while in class selection
GameTextForPlayer function - Displays game text to the player's screen
If you need a little explanation on any of the above code, please ask. It's always better to understand the code than to just plug it into your script.
As an alternative, you could also use GetPlayerSkin() to compare the skin, and then display the game text. However, that would be slightly less efficient.
pawn Код:
public OnPlayerRequestClass( playerid, classid ) {
switch( classid ) {
case 0: GameTextForPlayer( playerid, "~g~Army", 4000, 5 );
case 1: GameTextForPlayer( playerid, "~b~FBI", 4000, 5 );
}
return 1;
}
OnPlayerRequestClass callback - This function is called when the player enters class selection and each time they press a button while in class selection
GameTextForPlayer function - Displays game text to the player's screen
If you need a little explanation on any of the above code, please ask. It's always better to understand the code than to just plug it into your script.
As an alternative, you could also use GetPlayerSkin() to compare the skin, and then display the game text. However, that would be slightly less efficient.