Something simple yet soooo difficult. -
AmyX - 26.07.2011
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..
Re: Something simple yet soooo difficult. -
Desertsoulz - 26.07.2011
Post the whole OnPlayerDeath(playerid, killerid, reason) function in code here so we can take a look.
Re: Something simple yet soooo difficult. -
AmyX - 26.07.2011
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.
Re: Something simple yet soooo difficult. -
Desertsoulz - 26.07.2011
Every gamemode should have OnPlayerDeath(playerid, killerid, reason) ...
Re: Something simple yet soooo difficult. -
AmyX - 26.07.2011
Grand Larceny as a default did NOT. Anyways, what do I do with it to make it so you spawn where you died?
Re: Something simple yet soooo difficult. -
Kitten - 26.07.2011
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;
}
Re: Something simple yet soooo difficult. -
Desertsoulz - 26.07.2011
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;
}
Re: Something simple yet soooo difficult. -
AmyX - 26.07.2011
I tried your script, and Pawn stopped working when I hit compile... 0.o
Re: Something simple yet soooo difficult. -
Desertsoulz - 26.07.2011
did you tab the spaces?
Re: Something simple yet soooo difficult. -
AmyX - 26.07.2011
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.