SA-MP Forums Archive
Player spawn at the same place after death.. HELP! - 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: Player spawn at the same place after death.. HELP! (/showthread.php?tid=534436)



Player spawn at the same place after death.. HELP! - dark_ghost - 29.08.2014

Hello there!
I'm modifying a zombie gamemode and there's the zombie spawn and the human spawn. The zombie spawn works perfectly, it spawn at its choosen coordinates. The human spawn just spawn at the same place, and the line of coding are pretty much the same.. I'd like to put a spawn of humans at certain coordinates like the zombie spawn does, so, they'll spawn at hidden places or something..

There's the line of coding of OnPlayerSpawn and of the OnPlayerDeath:

http://pastebin.com/PCYYKzge


Thanks!


Re: Player spawn at the same place after death.. HELP! - taimoor - 29.08.2014

The last two spawns have the same coords

You have to change one of it wherever you like and wherever want to spawn


Re: Player spawn at the same place after death.. HELP! - dark_ghost - 30.08.2014

Well, I did that and the human class keeps spawning at the same place where he dies instead of the choosen coords. The zombie spawn does spawn in the choosen coords when the zombie player dies. Is there anything wrong or something to fix the human spawn?


Re: Player spawn at the same place after death.. HELP! - Eth - 30.08.2014

maybe because of this onplayerdeath?
pawn Код:
GetPlayerPos(playerid,positionx,positiony,positionz);
    JugadorInfo[playerid][jPos_x] = positionx;
        JugadorInfo[playerid][jPos_y] = positiony;
        JugadorInfo[playerid][jPos_z] = positionz;
maybe delete it?


Re: Player spawn at the same place after death.. HELP! - Eth - 30.08.2014

pawn Код:
else if(JugadorInfo[playerid][jInfectado] == 0 && JugadorInfo[playerid][jZombie] == 0)
                {
as you can see and as i think jinfectado = if inficted == 0, and if he is not a zombie ,
that what will happen:
pawn Код:
SafeSetPlayerPos(playerid,JugadorInfo[playerid][jPos_x],JugadorInfo[playerid][jPos_y],JugadorInfo[playerid][jPos_z]);
so i think that u need to delete it, am i right?


Re: Player spawn at the same place after death.. HELP! - dark_ghost - 30.08.2014

Well, i've deleted that :

GetPlayerPos(playerid,positionx,positiony,position z);
JugadorInfo[playerid][jPos_x] = positionx;
JugadorInfo[playerid][jPos_y] = positiony;
JugadorInfo[playerid][jPos_z] = positionz;

and it gave me 3 new warnings after compiling. I've tested it in-game and when you die it spawns you at the default coord, between las venturas and los santos, in a town. It's the 0,0,0 one i believe.


Re: Player spawn at the same place after death.. HELP! - dark_ghost - 30.08.2014

public SafeSetPlayerPos(playerid, Float, Float:y, Float:z)
{
SetPlayerPos(playerid, x,y,z);
return 1;
}


There's the public SafeSetPlayerPos btw. Do i have to change anything on it?


Re: Player spawn at the same place after death.. HELP! - dark_ghost - 30.08.2014

By the way, there's three type of spawn i believe. When you are human, when you are zombie and when you are infected.


Re: Player spawn at the same place after death.. HELP! - Eth - 30.08.2014

at each
which_spawn
type this:
pawn Код:
JugadorInfo[playerid][jPos_x] = positionx;
        JugadorInfo[playerid][jPos_y] = positiony;
        JugadorInfo[playerid][jPos_z] = positionz;
but edit the positionx with the x of setplayerpos in each which_spawn and the y of setplayerpos in each which_spawn and z of setplayerpos in each which_spawn and make sure you only did it for ehumano only


Re: Player spawn at the same place after death.. HELP! - dark_ghost - 30.08.2014

Its working! Thank you so much, man! I'll tell you later if i'll get any problem with it again, ahaha!
Have a nice weekend! :b