spawns not working
#1

Hello, i've made the spawns, im not getting any error.. i've tried placing them on OnPlayerSpawn too, but doesn't work..




Code:
public OnPlayerRequestSpawn(playerid)
{
	if(GetPlayerTeam(playerid) == TEAM_FBI)
	{
	new Random = random(sizeof(teamFBIspawns));
	SetPlayerPos(playerid, teamFBIspawns[Random][0], teamFBIspawns[Random][1], teamFBIspawns[Random][2]);
	}
	
	if(GetPlayerTeam(playerid) == TEAM_CIA)
	{
	new Random = random(sizeof(teamCIAspawns));
	SetPlayerPos(playerid, teamCIAspawns[Random][0], teamCIAspawns[Random][1], teamCIAspawns[Random][2]);
	}
	if(GetPlayerTeam(playerid) == TEAM_ARMY)
	{
	new Random = random(sizeof(teamArmyspawns));
	SetPlayerPos(playerid, teamArmyspawns[Random][0], teamArmyspawns[Random][1], teamArmyspawns[Random][2]);
	}
	if(GetPlayerTeam(playerid) == TEAM_FIREMAN)
	{
	new Random = random(sizeof(teamFiremanspawns));
	SetPlayerPos(playerid, teamFiremanspawns[Random][0], teamFiremanspawns[Random][1], teamFiremanspawns[Random][2]);
	}
	if(GetPlayerTeam(playerid) == TEAM_MEDIC)
	{
	new Random = random(sizeof(teamMedicspawns));
	SetPlayerPos(playerid, teamMedicspawns[Random][0], teamMedicspawns[Random][1], teamMedicspawns[Random][2]);
	}
	if(GetPlayerTeam(playerid) == TEAM_POLICE)
	{
	new Random = random(sizeof(teamCopspawns));
	SetPlayerPos(playerid, teamCopspawns[Random][0], teamCopspawns[Random][1], teamCopspawns[Random][2]);
	}
	if(GetPlayerTeam(playerid) == TEAM_CIVILIAN)
	{
	new Random = random(sizeof(teamCivilspawns));
	SetPlayerPos(playerid, teamCivilspawns[Random][0], teamCivilspawns[Random][1], teamCivilspawns[Random][2]);
	}
	return 1;
}



PS: I am not getting any ERROR
Reply
#2

Well im pretty sure that they should be under OnPlayerSpawn, but random function seems alright for me.Could you paste the code how you define those spawn positions?
Reply
#3

Use SetSpawnInfo

https://sampwiki.blast.hk/wiki/SetSpawnInfo
Reply
#4

OnPlayerRequestSpawn returns SpawnPlayer on returning 1 and returning 0 wont SpawnPlayer, therefore using SetPlayerPos wont do anything here.
try it under OnPlayerSpawn or use SetSpawnInfo.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)