SA-MP Forums Archive
Class Selection Without AddPlayerClass? - 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)
+--- Thread: Class Selection Without AddPlayerClass? (/showthread.php?tid=335976)



Class Selection Without AddPlayerClass? - Admigo - 20.04.2012

Heey all,

I made a class selection without AddPlayerClass.
But how can i make if the player reached the max case(last class skin) it will be switched to case 0(first class skin).
For Test i made 3 classes.
Код:
public OnPlayerRequestClass(playerid, classid)
{
	
 	switch(classid)
	{
		case 0://1 needs to be 0
		{
			SetPlayerSkin(playerid,0);
		}
		case 1:
		{
			SetPlayerSkin(playerid,1);
		}
		case 2:
		{
			SetPlayerSkin(playerid,2);
		}
	}
	return 1;
}
How i can reset the class selection(to case 0 if reached case 2)?

Thanks Admigo


Re: Class Selection Without AddPlayerClass? - aRoach - 20.04.2012

Try this, at the top of OnPlayerRequestClass
pawn Код:
if( classid > 2 ) classid = 0;



Re: Class Selection Without AddPlayerClass? - Admigo - 20.04.2012

Quote:
Originally Posted by aRoach
Посмотреть сообщение
Try this, at the top of OnPlayerRequestClass
pawn Код:
if( classid > 2 ) classid = 0;
Dont work,it switch me to CJ Skin and then when i choose next skin its still CJ:S


Re: Class Selection Without AddPlayerClass? - Admigo - 20.04.2012

Quote:
Originally Posted by ******
Посмотреть сообщение
"classid" is the currently selected class as defined by "AddPlayerClass" - if you have none of those you have no "classid", and thus you will only ever have it called with "0".

If you want more advanced control of class selection I suggest you check out y_classes - that can add and remove classes for players dynamically (and if you don't want those sorts of features, why are you not using "AddPlayerClass" in the first place)?
Can you give a example of your script what i want?