How to Make teams???
#1

I Make a Gamemode and i want in it 10 Soldiers,And 10 GoodGuys and also 3 Admins
I Want to make these as teams but also with a limit so how can i do that?
Reply
#2

Okay, you need to do few things. I will list them as steps.

Step1: Define teams (i hope you know how). They should be called "ADMIN", "SOLDIER", "GOODGUY".

Step2: Look under OnPlayerRequestSpawn. You need to check how many people are in all the teams. Do it like this:

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
new Admins=0;
new Soldiers=0;
new GoodGuys=0;

for(new i=0; i<MAX_PLAYERS; i++)
{
switch(GetPlayerTeam(i))
{
case 0: Admins++;
case 1: Soldiers++;
case 2: GoodGuys++;
}
}

if(GetPlayerTeam(playerid)==ADMIN)
{
if(Admins>=3)
{
SendClientMessage(playerid, COLOR_ORANGE, "You can't spawn. There are 3 Admins online, yet.");
return 0;
}
}

if(GetPlayerTeam(playerid)==SOLIDER)
{
if(Soldiers>=10)
{
SendClientMessage(playerid, COLOR_ORANGE, "You can't spawn. There are 10 Soldiers online, yet.");
return 0;
}
}

if(GetPlayerTeam(playerid)==GOODGUY)
{
if(GoodGuys>=10)
{
SendClientMessage(playerid, COLOR_ORANGE, "You can't spawn. There are 10 good Guys online, yet.");
return 0;
}
}
return 1;
}
Now you should have a working Limit-part. Still have got questions?

Cheers,
DeathOnaStick
Reply
#3

Also:

http://forum.sa-mp.com/index.php?topic=132845.0
Reply
#4

Thank you all
Reply
#5

If you have old SA:MP 0.2 server files, in gamemode "cng", teams are very good scripted.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)