How to make player spawn at location where he was killed?
#1

Hello

So when player get killed how to set that he respawn on that same location and not on login location?

tnx
Reply
#2

pawn Код:
new Float:dsx,
    Float:dsy,
    Float:dsz;

public OnPlayerSpawn( playerid )
{
    SetPlayerPos( playerid, dsx, dsy, dsz );
    PlayerPlaySound( playerid, 1139, 0.0, 0.0, 0.0 );
    SendClientMessage( playerid, ~1, "SERVER: You have been respawned at murder place!" );
    return ( 1 );
}

public OnPlayerDeath( playerid, killerid, reason )
{
    GetPlayerPos( playerid, dsx, dsy, dsz );
    SendClientMessage( playerid, ~1, "SERVER: You died! You will respawn right here!" );
    return ( 1 );
}
Some man just don't say thx..
Reply
#3

tnx for that, but.....

I have one OnPlayerSpawn and OnPlayerDeath location and when i change it with your script, it works but on player login it spawn me on some different location not on original one.

I want to save original spawn position on player login but when player go somewhere and get killed, then i want that your script work and spawn on kill position.
Reply
#4

Quote:
Originally Posted by isheremse
Посмотреть сообщение
tnx for that, but.....

I have one OnPlayerSpawn and OnPlayerDeath location and when i change it with your script, it works but on player login it spawn me on some different location not on original one.

I want to save original spawn position on player login but when player go somewhere and get killed, then i want that your script work and spawn on kill position.
That's because you have already custom spawn coordinates, remove it and then add the code that Anonym2009 gave you.
Reply
#5

Quote:
Originally Posted by Logitech90
Посмотреть сообщение
That's because you have already custom spawn coordinates, remove it and then add the code that Anonym2009 gave you.
I have done that, and it work for that coordinate, but i want to keep my original coordinate of spawn point.

And then when player leave from original spawn point and get killed elsewhere, he can respawn on kill position and move on, not to be reset to original spawn.
Reply
#6

Quote:
Originally Posted by isheremse
Посмотреть сообщение
I have done that, and it work for that coordinate, but i want to keep my original coordinate of spawn point.

And then when player leave from original spawn point and get killed elsewhere, he can respawn on kill position and move on, not to be reset to original spawn.
You should set a FirstSpawn variable or something, add by +1 on the first death and then add your custom spawn coordinates.
Reply
#7

Something like this:

pawn Код:
new FirstSpawn[MAX_PLAYERS];

OnPlayerDeath:

FirstSpawn[playerid] =1;

OnPlayerSpawn:

if(FirstSpawn[playerid] == 1)
{
//Your custom spawn coordinates
}
This won't 100% work, it's untested, better you set a bool with true or false conditions.
Reply
#8

Quote:
Originally Posted by Logitech90
Посмотреть сообщение
Something like this:

pawn Код:
new FirstSpawn[MAX_PLAYERS];

OnPlayerDeath:

FirstSpawn[playerid] =1;

OnPlayerSpawn:

if(FirstSpawn[playerid] == 1)
{
//Your custom spawn coordinates
}
This won't 100% work, it's untested, better you set a bool with true or false conditions.
hm....basically i need to set primary and secondary spawn in script
Reply
#9

Yeah, a sort of.
Reply
#10

damn...i can't get it to work, can i put here OnPlayerSpawn and OnPlayerDeath script to solve this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)