SA-MP Forums Archive
[ERROR] Spawn at the center of the map... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [ERROR] Spawn at the center of the map... (/showthread.php?tid=427956)



[ERROR] Spawn at the center of the map... - Daledos - 03.04.2013

Hello, I created a nice tutorial system that sometimes makes me whims, and not spawn in the exact spot (airport), the gameplay is roleplay and the script is a little put at random.

Код:
		if(PlayerInfo[playerid][pRegistered] == 0)
		        
                        {
                        TogglePlayerControllable(playerid,1);
			PlayerInfo[playerid][pLevel] = 1;
			PlayerInfo[playerid][pBank] = 0;
			PlayerInfo[playerid][pSkin] = 29;
			PlayerInfo[playerid][pCash] = 0;
			gPlayerLogged[playerid] = 1;
                        SetPlayerPos(playerid,-1828.8499,18.3889,1061.1436);
	                SetPlayerInterior(playerid, 14);
	                SetPlayerVirtualWorld(playerid, 0);
	                SpawnPlayer(playerid);
	                SpawnAereoporto[playerid] = 1;
			SetPlayerCash(playerid,PlayerInfo[playerid][pCash]);
		        ShowPlayerDialog(playerid,19,DIALOG_STYLE_INPUT,"Etа","Quanti anni vuoi avere? Digita un etа tra                                        1 a 100 anni","Avanti","Annulla");
		        PlayerPlaySound(playerid, 1069, 0.0, 0.0, 0.0);
			      }
Thank's a lot!


Re: [ERROR] Spawn at the center of the map... - LarzI - 03.04.2013

Use SetSpawnInfo


Re: [ERROR] Spawn at the center of the map... - Pottus - 03.04.2013

Yes, SetPlayerPos() is poor for this kind of thing, use SetSpawnInfo()


Re: [ERROR] Spawn at the center of the map... - Daledos - 03.04.2013

Thanks, I tried but always spawn in the center of the map


Re: [ERROR] Spawn at the center of the map... - LarzI - 03.04.2013

SetSpawnInfo before SpawnPlayer


Re: [ERROR] Spawn at the center of the map... - Daledos - 04.04.2013

Not working... spawn in the center of the map....... I only work rotation!!

Код:
		if(PlayerInfo[playerid][pRegistered] == 0)
		{
                SetSpawnInfo(playerid, 0, 29,-1828.84,18.38,1061.14,269.15,0,0,0,0,0,0);
	        SetPlayerInterior(playerid, 14);
                SetPlayerVirtualWorld(playerid, 0);
                SpawnPlayer(playerid);
                TogglePlayerControllable(playerid,1);
		PlayerInfo[playerid][pLevel] = 1;
	        PlayerInfo[playerid][pBank] = 0;
		PlayerInfo[playerid][pSkin] = 29;
		PlayerInfo[playerid][pCash] = 0;
		gPlayerLogged[playerid] = 1;
		SpawnAereoporto[playerid] = 1;
		SetPlayerCash(playerid,PlayerInfo[playerid][pCash]);
		ShowPlayerDialog(playerid,19,DIALOG_STYLE_INPUT,"Age","How many years have you?","Next","Cancel");
		PlayerPlaySound(playerid, 1069, 0.0, 0.0, 0.0);
			      }



Re: [ERROR] Spawn at the center of the map... - Daledos - 04.04.2013

UP.... I'm hopeless


Re: [ERROR] Spawn at the center of the map... - Daledos - 07.04.2013

UP.... I'm hopeless


Re: [ERROR] Spawn at the center of the map... - Riddick94 - 07.04.2013

Wait, it doesn't make any sense..

pawn Код:
SetPlayerPos(playerid,-1828.8499,18.3889,1061.1436);
SetPlayerInterior(playerid, 14);
SetPlayerVirtualWorld(playerid, 0);
SpawnPlayer(playerid);
You're setting player some position and then you want to spawn him again... so that means a double-spawn, why? However, you said that you wan't to spawn player on the airport, is it outside or inside somewhere? cause I see interior is different than 0, just a security question.

pawn Код:
SetSpawnInfo(playerid, 0, 29,-1828.84,18.38,1061.14,269.15,0,0,0,0,0,0);
Move it to the OnPlayerRequestClass callback or try OnPlayerConnect (not sure is Connecting gonna make it).


Re: [ERROR] Spawn at the center of the map... - Shoulen - 07.04.2013

If you want your script to work just put SetPlayerPos after SpawnPlayer(), but otherwise use SetSpawnInfo instead. Just answering your original question.