Something simple yet soooo difficult.
#1

Hey guys, I am working on a free roam game mode, and I need to know.

Is there a script, or something I need to delete to make it so you spawn in the same area you died? We do not like dying at the airport, and having to drive all the way back to it when or if we crash a plane. Could any of you help me with this? I looked at the Wiki, and I didn't find anything..
Reply
#2

Post the whole OnPlayerDeath(playerid, killerid, reason) function in code here so we can take a look.
Reply
#3

My script does not have anything like that. I used Grand Larceny as a basis, btw. I'm not going to pot my game mode as my own from scratch creation, though.

There, I made one I found in a tutorial, this is what it looks like.

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}
Very basic.
Reply
#4

Every gamemode should have OnPlayerDeath(playerid, killerid, reason) ...
Reply
#5

Grand Larceny as a default did NOT. Anyways, what do I do with it to make it so you spawn where you died?
Reply
#6

pawn Код:
// On top of your script
enum Positions
{
    Float:XPos,
    Float:YPos,
    Float:ZPos,
};
new Position2[MAX_PLAYERS][Positions];
public OnPlayerSpawn(playerid) {
    SetPlayerPos(playerid,Position2[playerid][XPos],Position2[playerid][YPos],Position2[playerid][ZPos]);
    return 1;
}
public OnPlayerDeath(playerid , killerid , reason ) {
    GetPlayerPos(playerid,Position2[playerid][XPos],Position2[playerid][YPos],Position2[playerid][ZPos]);
    return 1;
}
Reply
#7

Now add somewhere above ongamemodeinit...

Код:
new Player[MAX_PLAYERS][Pos][5];
Then...
Код:
public OnPlayerUpdate(playerid) // this should already be a function in your gamemode.
{
 Player[playerid][Pos][0] = GetPlayerVirtualWorld(playerid);
 Player[playerid][Pos][1] = GetPlayerInterior(playerid);
 GetPlayerPos(playerid, Player[playerid][Pos][2], Player[playerid][Pos][3], Player[playerid][Pos][4]);
 return 1;
}
then in
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
 SetPlayerVirtualWorld(playerid, Player[playerid][Pos][0]);
 SetPlayerInterior(playerid, Player[playerid][Pos][1]);
 SetPlayerPos(playerid, Player[playerid][Pos][2], Player[playerid][Pos][3], Player[playerid][Pos][4]);
 return 1;
}
Reply
#8

I tried your script, and Pawn stopped working when I hit compile... 0.o
Reply
#9

did you tab the spaces?
Reply
#10

Not sure what you mean, but anywhere I needed to add a space, I did. (Space as in ht enter a few)

Код:
new Player[MAX_PLAYERS][Pos][5];
That's what is causing PAWN to freeze.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)