SA-MP Forums Archive
i need a tut on how to create team classes - 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: i need a tut on how to create team classes (/showthread.php?tid=139125)



i need a tut on how to create team classes - Owenlishious - 04.04.2010

hello allow me to introduce myself...im owen

i began scripting a couple of days ago and so far i understand some the the scripting thats done.

but now im trying to create teams such as cop,army,civilians

now before you say "use the search feature"...i already have, and it hasent helped cause some people dunno how to explain stuff :P

and i seen the wikipage on how to create the dm server that also includes how to create teams...but yet again...i dunno how to put the code in the proper place,cause it dident mention...

so can someone with good grammer (and a set of scripting skills) explain step by step on how to add the proper codes for adding teams

so just help me out?

thx !


~Owen


Re: i need a tut on how to create team classes - Owenlishious - 04.04.2010

ill give anyone a cookie through email if anyone helps me out :P


Re: i need a tut on how to create team classes - _realistixpiumitiumixdro_ - 04.04.2010

its on samp site


Re: i need a tut on how to create team classes - Owenlishious - 04.04.2010

lol u dident even bother looking at my post....

i said i have already checked -_-


Re: i need a tut on how to create team classes - Lajko1 - 04.04.2010

Код:
//top of script
#define TEAM_COP 0
#define TEAM_TAXI 1
under this add

Код:
new gTeam[MAX_PLAYERS];
Some where in script put this NOT UNDER PUBLIC just put somewhere ...
that means if classid will be 0 he will be in team ''COP'' if he will be other skin he will be in team TAXI

Код:
SetPlayerTeamFromClass(playerid, classid)
{
	if (classid == 0)
	{
		gTeam[playerid] = TEAM_COP;
	}
	else
	{
		gTeam[playerid] = TEAM_TAXI;
	}
}
if you have more skins USE THIS!!!

Код:
SetPlayerTeamFromClass(playerid, classid)
{
	if (classid == 0)
	{
		gTeam[playerid] = TEAM_GROVE;
	}
	if(classid == 1)
	{
		gTeam[playerid] = TEAM_BALLA;
	}
    //if(classid == 1,2,3,4,5)
    //{
    // code
    //}
}
put this under OnPlayerRequestClass
Код:
SetPlayerTeamFromClass(playerid, classid);
Than let our teams have colours:

add this SOMEWHERE IN SCRIPT NOT UNDER PUBLIC

Код:
SetPlayerToTeamColor(playerid)
{
	if (gTeam[playerid] == TEAM_COP)
	{
		SetPlayerColor(playerid, put here your colour); // perfer blue
	}
	else if (gTeam[playerid] == TEAM_TAXI)
	{
		SetPlayerColor(playerid, put here your colour); // perfer green
	}
}
EDIT: and under OnPlayerSpawn add this: so when you will spawn it will set them to their colors...
Код:
SetPlayerToTeamColor(playerid);
and this if for you

scroll down a bit and you will find tutorial! How to make teams
https://sampwiki.blast.hk/wiki/PAWN_tutorial

and for other things
http://wiki.sa-mp.com

its the same page btw

have a nice day



Re: i need a tut on how to create team classes - Anthonyx3' - 04.04.2010

thanks i needed this also .


Re: i need a tut on how to create team classes - Owenlishious - 04.04.2010

that tut help me ALOT!

thx mate




Re: i need a tut on how to create team classes - ~JDS - 05.04.2010

even easier way:

https://sampwiki.blast.hk/wiki/AddPlayerClassEx

When you add player classes use AddPlayerClassEx instead of AddPlayerClass. This lets you define team-ids for classes.

Код:
AddPlayerClassEx(teamid, skinid, Float:x, Float:y, Float:z, Float:Angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);