PDA

View Full Version : spawns not working


div
17/06/2018, 04:36 AM
Hello, i've made the spawns, im not getting any error.. i've tried placing them on OnPlayerSpawn too, but doesn't work..





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

Mike861
17/06/2018, 06:47 AM
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?

Exhibit
17/06/2018, 08:43 AM
Use SetSpawnInfo

http://wiki.sa-mp.com/wiki/SetSpawnInfo

Zeth
17/06/2018, 08:48 AM
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.