SA-MP Forums Archive
Need Some Help. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need Some Help. (/showthread.php?tid=261091)



Need Some Help. - Bmxerlmao5288 - 12.06.2011

On The Skin Selection Spawn thing I want it to say the name of the team the player belongs to. There are two Skins and there are two Teams Army Guy Belongs In Army And FBI Guy Belongs In FBI.

But i want it to be Labeled So Some people dont freak out and wonder which team is which (Just To Make It Showable) I have added Pictures Of what im talking about







Re: Need Some Help. - Bakr - 12.06.2011

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:
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;
}
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.