SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Thread Tools Display Modes
Old 17/06/2018, 04:36 AM   #1
Huge Clucker
Join Date: Dec 2017
Location: Rajasthan ka chorra :P
Posts: 216
Reputation: 18
Default spawns not working

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
div is offline   Reply With Quote
Old 17/06/2018, 06:47 AM   #2
Huge Clucker
Join Date: Feb 2018
Posts: 233
Reputation: 16
Default Re: spawns not working

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?
Mike861 is offline   Reply With Quote
Old 17/06/2018, 08:43 AM   #3
Big Clucker
Join Date: Dec 2015
Location: Pakistan
Posts: 180
Reputation: 22
Default Re: spawns not working

Use SetSpawnInfo
Exhibit is offline   Reply With Quote
Old 17/06/2018, 08:48 AM   #4
Huge Clucker
Zeth's Avatar
Join Date: Feb 2017
Location: Titan
Posts: 428
Reputation: 114
Default Re: spawns not working

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.
Zeth is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Random team spawns not working stormchaser206 Scripting Help 5 05/03/2018 12:57 AM
Random spawns not working DwayneMichael Scripting Help 8 18/08/2016 04:32 PM
Random spawns not working XxCozzaxX Scripting Help 3 29/12/2011 08:29 AM
Player Spawns not working darkknight123 Help Archive 5 10/02/2011 12:18 AM
Random Spawns + Previous Spawns XtremeChio Help Archive 2 01/09/2009 01:57 PM

All times are GMT. The time now is 07:39 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.