SA-MP Forums Archive
Class names - 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: Class names (/showthread.php?tid=62298)



Class names - [GPS]Chris - 19.01.2009

How can I give a class a name at the spawning screen?


Re: Class names - SmartyPants - 19.01.2009

Quote:
Originally Posted by [GPS
Chris ]
How can I give a class a name at the spawning screen?
GameTextForPlayer(playerid, "~r~Team Name Here", 2000, 5);

put this on "OnPlayerRequestClass(playerid, classid)"


Re: Class names - [GPS]Chris - 19.01.2009

Thanks for the help!


GameTextForPlayer(playerid, "~r~Team Name Here", 2000, 5); - TMNuclear - 28.03.2009

GameTextForPlayer(playerid, "~r~Team Name Here", 2000, 5);

I can't make up how to apply it to, let's say

make class id 100~148 all Police (colour blue)
149~160 all Hobo's (colour grey)
etc., you know what I mean

does ~r~ have to be changed by the preferred color? If yes, how? ~r~ -> ~blue~ ?
And what do 2000 and 5 stand for?
Thanks in advance.


Re: Class names - StrickenKid - 28.03.2009

~r~ = red
~b~ = blue
~p~ = purple
~y~ = yellow
~g~ = green

etc... just use first letter of color you want with "~" before letter and after

also when using class selection if you want to use diff names for diff characters just use a simple switch code:
pawn Код:
switch(classid)
{
   case 1..5: GameTextForPlayer(playerid, "~r~Team 1 Name Here", 2000, 5); <---- Skins: 1 through 5
   case 6..10: GameTextForPlayer(playerid, "~r~Team 2 Name Here", 2000, 5); <---- Skins 6 through 10
}
and you can keep going

EDIT: the 2000 stands for the milliseconds the text will show onscreen so the text will who for 2 seconds unill it goes away
The "5" means the style of the text, go here for all styles: https://sampwiki.blast.hk/wiki/GameTextStyle


Re: Class names - TMNuclear - 28.03.2009

Thanks man
But since I'm a noob I don't know where to put the switch into...
Or better said, I don't know how to put it together.


My idea is like this:

public OnPlayerRequestClass(playerid, classid)
{
switch(classid)
{
case 1..5: GameTextForPlayer(playerid, "~r~Team 1 Name Here", 2000, 5); // <---- Skins: 1 through 5
case 6..10: GameTextForPlayer(playerid, "~r~Team 2 Name Here", 2000, 5); // <---- Skins 6 through 10
}
SetPlayerPos(playerid, 1059.6108,-344.4459,73.9922);
SetPlayerFacingAngle(playerid, 1.7606);
SetPlayerCameraPos(playerid, 1059.4236,-340.5163,73.9922);
SetPlayerCameraLookAt(playerid, 1059.6108,-344.4459,73.9922);
return 1;
}


Just a second, maybe I am right :P

Allright, yes!! Thanks alot, it works


Problem :( - TMNuclear - 28.03.2009

Now I added this:

public OnPlayerRequestClass(playerid, classid)
{
switch(classid)
{
case 1..19: GameTextForPlayer(playerid, "~w~Civilian", 2000, 6);5
case 20..25: GameTextForPlayer(playerid, "~g~Groove", 2000, 6);
case 26..28: GameTextForPlayer(playerid, "~p~Ballas", 2000, 6);
case 29..31: GameTextForPlayer(playerid, "~r~Aztecas", 2000, 6);
case 32..34: GameTextForPlayer(playerid, "~r~Vagos", 2000, 6);
case 35..37: GameTextForPlayer(playerid, "~r~Da Nang Boys, 2000, 6);
case 38..40: GameTextForPlayer(playerid, "~r~Rifa", 2000, 6);
case 41..43: GameTextForPlayer(playerid, "~r~Traids", 2000, 6);
case 44..47: GameTextForPlayer(playerid, "~r~Bikers", 2000, 6);
case 48..55: GameTextForPlayer(playerid, "~r~Mafia", 2000, 6);
}

I referred the cases just like the way I added AddPlayerClass (x,y,z, etc.) every line is 1 case I presume.
Now I'm full of errors like this:

error 002: only a single statement (or expression) can follow each "case"
error 014: invalid statement; not in switch
warning 215: expression has no effect

And another thing, am I able to put an advanced color code in the place of ~r~ ? Like: ~#FF0000~ or something?
Maybe you can also answer which are the colors that do count?
Thanks in advance.







Argh never mind! Made a mistake!!




Re: Class names - Rks25 - 28.03.2009

case 1..19: GameTextForPlayer(playerid, "~w~Civilian", 2000, 6);5
Remove that.



Re: Class names - TMNuclear - 28.03.2009

Yes that's the mistake xD
And missed an " after Da Nang Boys.

Now my only question is about the colors


Re: Class names - Rks25 - 28.03.2009

No that is not possible, you can do that in TextDraw.


TextDraw !! - TMNuclear - 28.03.2009

Ok, that's some hard stuff I guess, I'm going to have a look.


Re: Class names - TMNuclear - 28.03.2009

Me again :P

I've got a TextDraw program, so I can design it in-game.
But how do I add all that to the select character menu AND to make it function with the different cases?
Yes, that's a hard question I guess :P


Re: Class names - Rks25 - 28.03.2009

no it is not.
You create it in game and save it using Zamaroht's Editor.
Than you go to general reference or wiki and see how textdraw works.


To Rk_ - TMNuclear - 28.03.2009

Rk_, I sent you a PM but I ask it here too, how do I export the file after editing with the Draw Editor?


Re: Class names - Rks25 - 28.03.2009

if you open the file, you see the steps in it, like:
// put this below OnGameModeIinit.
etc.etc


Re: Class names - TMNuclear - 28.03.2009

Which file?
I only got one, which is Draw Editor in filterscript