Random teams.
#1

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

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#2

Replace this with yours and compile again. Tell me what you get?

pawn Код:
new RandomTeams[][] =
{
    {TEAM_OFFENSE},
    {TEAM_DEFENSE}
};
Reply
#3

Works fine, thank you.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)