Random team spawns need help :S
#1

so i want to make players respawn randomly after they die at each teams respawn place
so far i got this but when i try to compile, SAM[P]CE shows me this error :
"possibly unintended assignment" pawn0 too
pls help me i got only 2 weeks scripting :S

Code:
new Float:RandomSpawnsSwat[][] = 
{
	{1775.8531,-1303.9132,120.2586,272.4887},
	{1774.5525,-1306.3617,120.2586,274.0972},
	{1774.6008,-1301.7284,120.2586,270.8802},
	{1771.9750,-1303.1437,120.2586,265.5953},
	{1778.1970,-1303.5835,120.2586,271.5696}
};
new Float:RandomSpawnsArmy[][] =
{
	{1833.1782,-1292.7540,120.2656,10.1452},
	{1827.6752,-1291.5758,120.2656,17.0386},
	{1831.7612,-1308.2998,120.2656,182.9397},
	{1827.4015,-1309.8148,120.2656,178.1143}
};
public OnPlayerSpawn(playerid)
{
	if(gTeam[playerid] = TEAM_SWAT)  //on this line
	{	new Random = random(sizeof(RandomSpawnsSwat));
		SetPlayerPos(playerid, RandomSpawnsSwat[Random][0], RandomSpawnsSwat[Random][1], RandomSpawnsSwat[Random][2]);
		SetPlayerFacingAngle(playerid, RandomSpawnsSwat[Random][3]);
	}
	else if(gTeam[playerid] = TEAM_ARMY) //and this one
	{
		new Random = random(sizeof(RandomSpawnsSwat));
		SetPlayerPos(playerid, RandomSpawnsArmy[Random][0], RandomSpawnsArmy[Random][1], RandomSpawnsArmy[Random][2]);
		SetPlayerFacingAngle(playerid, RandomSpawnsArmy[Random][3]);
	}
	return 1;
}
help me fix thiis pls
Reply
#2

instead of
Quote:

if(gTeam[playerid] = TEAM_SWAT) //on this line

and
Quote:

else if(gTeam[playerid] = TEAM_ARMY) //and this one

do this:
Quote:

if(gTeam[playerid] == TEAM_SWAT) //on this line

and
Quote:

else if(gTeam[playerid] == TEAM_ARMY) //and this one

so write "==" in a conditional instead of "=" because with '=' you assign a value, and with '==' you check whether the two values are the same.
Reply
#3

also I'm not sure you can use "Random" as a variable name, because it's a function name too.. but I'm not sure.
Quote:

This forum requires that you wait 120 seconds between posts. Please try again in 1 seconds.

Reply
#4

Quote:
Originally Posted by KoczkaHUN
View Post
instead of

and

do this:

and

so write "==" in a conditional instead of "=" because with '=' you assign a value, and with '==' you check whether the two values are the same.
ty bro
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)