PDA

View Full Version : Random teams.


Blunt
08/05/2012, 07:08 PM
Alright so recently I tried making some random teams, but couldn't get my mind round it.
I got some errors which will be posted below, and I need a new code or someone to tell me how and what to do, to make it run smoothly.

So this is what I come up with.

new Float:RandomTeams[][] =
{
{TEAM_OFFENSE},
{TEAM_DEFENSE}
};

CMD:randomteam(playerid, params[])
{
new RandomTeam = random(sizeof(RandomTeams));
SetPlayerTeam(playerid, RandomTeam[RandomTeam][0]);
return 1;
}

I go to compile and I get these errors.

C:\Users\Mike\Desktop\Scripting\gamemodes\PRTDM.pw n(2580) : error 028: invalid subscript (not an array or too many subscripts): "RandomTeam"
C:\Users\Mike\Desktop\Scripting\gamemodes\PRTDM.pw n(2580) : warning 215: expression has no effect
C:\Users\Mike\Desktop\Scripting\gamemodes\PRTDM.pw n(2580) : error 001: expected token: ";", but found "]"
C:\Users\Mike\Desktop\Scripting\gamemodes\PRTDM.pw n(2580) : error 029: invalid expression, assumed zero
C:\Users\Mike\Desktop\Scripting\gamemodes\PRTDM.pw n(2580) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.

Ballu Miaa
08/05/2012, 07:12 PM
Replace this with yours and compile again. Tell me what you get?

new RandomTeams[][] =
{
{TEAM_OFFENSE},
{TEAM_DEFENSE}
};

Blunt
08/05/2012, 07:16 PM
Works fine, thank you.