Auto Assigning Player
#1

Hello,

i creating a paintball system, but. how i can auto assign player team

EXAMPLE:
when player join arena, he auto assign to red team, and next player auto assign to blue team

can you show me the script/code?
Reply
#2

I'm on mobile i can't show you example code but i'll explain it for you
1.Make 2 variables for red and blue team
For example
new RedTeam;
new BlueTeam;
When you start event (with cmd or timer)
Set this variables 0
2.when someone join to paintball
check that which variable is lower that other
And set to that team
For example
pawn Код:
if(RedTeam >= BlueTeam)
{
SetPlayerTeam(playerid, RedTeam);
RedTeam++;
}
else if(BlueTeam > RedTeam)
{
Set PlayerTeam(playerid, BlueTeam);
BlueTeam++;
}
Sorry if explained it bad
And sorry for my bad english
Good luck buddy
Reply
#3

Put that code in join paintball cmd?
Reply
#4

Yes make variables and set them 0 when you start the event
And then put that code in join command.
Please try to understand code and don't copy and paste..
Reply
#5

And how to set the RedTeam And BlueTeam skin and gun??

(im little bit understand now)
Reply
#6

for example, each team has each skin you mean,

M4D codes with my edited.

pawn Код:
if(RedTeam >= BlueTeam)
{
SetPlayerTeam(playerid, RedTeam);
SetPlayerSkin(playerid, 1); // example: get more skins on: https://sampwiki.blast.hk/wiki/Skins:All
RedTeam++;
}
else if(BlueTeam > RedTeam)
{
SetPlayerTeam(playerid, BlueTeam);
SetPlayerSkin(playerid, 0); // example: get more skins on: https://sampwiki.blast.hk/wiki/Skins:All
BlueTeam++;
}
Reply
#7

can i use force class selection if player leave the paintball arena??

EDIT: how i can change the variable number, my variable is
pawn Код:
User[playerid][USER_KD]
my joinarena cmd
pawn Код:
CMD:joinarena(playerid, params[])
{
    if(RedTeam >= BlueTeam)
   {
   SetPlayerTeam(playerid, RedTeam);
   SetPlayerSkin(playerid, 1); // example: get more skins on: https://sampwiki.blast.hk/wiki/Skins:All
   RedTeam++;
   }
    else if(BlueTeam > RedTeam)
   {
   SetPlayerTeam(playerid, BlueTeam);
   SetPlayerSkin(playerid, 0); // example: get more skins on: https://sampwiki.blast.hk/wiki/Skins:All
   BlueTeam++;
   }
    User[playerid][USER_KD] 0);
    return 1;
}
it return the error
pawn Код:
warning 215: expression has no effect
warning 215: expression has no effect
C:\Users\bcamaster\Saved Games\STDM Server\gamemodes\atdmindo.pwn(1491) : error 001: expected token: ";", but found "-integer value-"
C:\Users\bcamaster\Saved Games\STDM Server\gamemodes\atdmindo.pwn(1491) : warning 215: expression has no effect
C:\Users\bcamaster\Saved Games\STDM Server\gamemodes\atdmindo.pwn(1491) : error 001: expected token: ";", but found ")"
C:\Users\bcamaster\Saved Games\STDM Server\gamemodes\atdmindo.pwn(1491) : error 029: invalid expression, assumed zero
C:\Users\bcamaster\Saved Games\STDM Server\gamemodes\atdmindo.pwn(1491) : fatal error 107: too many error messages on one line
all error in the User[playerid][USER_KD] line
Reply
#8

We don't know how your paintball system work and how you check someone left paintball
But
When a player leave paintball:

pawn Код:
ForceClassSelection(playerid);
TogglePlayerSpectating(playerid, true);
TogglePlayerSpectating(playerid, false);
** please search…
https://sampwiki.blast.hk/wiki/ForceClassSelection
Reply
#9

how i can change the variable? it just face me an error (the error is showed up in my edited post)
Reply
#10

You have to learn basics buddy
Please read wiki and pawn lang.pdf

User[playerid][PaintBall] = 1;

1 or 0… change it if you want
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)