i need a tut on how to create team classes
#1

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
Reply
#2

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

its on samp site
Reply
#4

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

i said i have already checked -_-
Reply
#5

Код:
//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
Reply
#6

thanks i needed this also .
Reply
#7

that tut help me ALOT!

thx mate

Reply
#8

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);
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)