new SFloatX[MAX_PLAYERS];
new SFloatY[MAX_PLAYERS];
new SFloatZ[MAX_PLAYERS];
OnPlayerDeath
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, Float:X, Float:Y, Float:Z);
SFloatX[playerid] = X
SFloatY[playerid] = Y
SFloatZ[playerid] = Z
}
OnPlayerSpawn
{
SetPlayerPos(playerid, SFloatZ[playerid], SFloatY[playerid], SFloatZ[playerid]);
}
new FloatX[MAX_PLAYERS];
new FloatY[MAX_PLAYERS];
new FloatZ[MAX_PLAYERS];
OnPlayerDeath
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
FloatX[playerid] = x;
FloatY[playerid] = y;
FloatZ[playerid] = z;
return 1;
}
OnPlayerSpawn
{
SetPlayerPos(playerid, FloatX[playerid], FloatY[playerid], FloatZ[playerid]);
FloatX[playerid]=0.0; FloatY[playerid]=0.0; FloatZ[playerid]=0.0;
return 1;
}
pawn Код:
|
/* Top of Script */
#define DIALOG_SPAWN (1000)
enum Dead_Info
{
Float:pX,
Float:pY,
Float:pZ,
VW,
Int,
Float:F_Angle
};
new dInfo[MAX_PLAYERS][Dead_Info];
public OnPlayerDeath(playerid, killerid, reason)
{
GetPlayerPos(playerid, dInfo[playerid][pX], dInfo[playerid][pY], dInfo[playerid][pZ]);
GetPlayerInterior(playerid, dInfo[playerid][Int]);
GetPlayerVirtualWorld(playerid, dInfo[playerid][VW]);
SetPVarInt(playerid, #Death, 1);
return 1;
}
public OnPlayerSpawn(playerid)
{
if(GetPVarInt(playerid, #Death) == 1)
{
ShowPlayerDialog(playerid, DIALOG_SPAWN, DIALOG_TYPE_MSGBOX, "Death Message", "Would you like to spawn where you died?", "Yes", "No");
DeletePVar(playerid, #Death);
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_SPAWN) {
if(response) {
SetPlayerPos(playerid, dInfo[playerid][pX], dInfo[playerid][pY], dInfo[playerid][pZ]);
SetPlayerInterior(playerid, dInfo[playerid][Int]);
SetPlayerVirtualWorld(playerid, dInfo[playerid][VW]);
SetPlayerFacingAngle(playerid, dInfo[playerid][F_Angle]);
}
}
return 1;
}
#define POS 200
new FloatX[MAX_PLAYERS];
new FloatY[MAX_PLAYERS];
new FloatZ[MAX_PLAYERS];
OnPlayerDeath
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
FloatX[playerid] = x;
FloatY[playerid] = y;
FloatZ[playerid] = z;
return 1;
}
OnPlayerSpawn
{
ShowPlayerDialog(playerid,POS,DIALOG_STYLE_MSGBOX,"Previous Position","Do you want to get back to the position where you died ?","Yes","No");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == POS)
{
if(response) // If they clicked 'Yes' or pressed enter
{
SetPlayerPos(playerid, FloatX[playerid], FloatY[playerid], FloatZ[playerid]);
FloatX[playerid]=0.0; FloatY[playerid]=0.0; FloatZ[playerid]=0.0;
}
return 1;
}
return 0; // You Must return 0 here..
}
#define DIALOG_SELECT_SPAWN 333
enum posInfo
{
Float:pX,
Float:pY,
Float:pZ,
Float:pA
};
new pos_info[MAX_PLAYERS][posInfo];
new IsSpawnAfterDeath[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
GetPlayerPos(playerid, pos_info[playerid][pX], pos_info[playerid][pY], pos_info[playerid][pZ]);
GetPlayerFacingAngle(playerid, pos_info[playerid][pA]);
IsSpawnAfterDeath[playerid] = 1;
return 1;
}
public OnPlayerSpawn(playerid)
{
if (IsSpawnAfterDeath[playerid] == 1)
{
ShowPlayerDialog(playerid, DIALOG_SELECT_SPAWN, DIALOG_STYLE_MSGBOX, "Select your spawn", "Would you like to go back where you died?", "Yes", "No");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == DIALOG_SELECT_SPAWN)
{
if (response)
{
SetPlayerPos(playerid, pos_info[playerid][pX], pos_info[playerid][pY], pos_info[playerid][pZ]);
SetPlayerFacingAngle(playerid, pos_info[playerid][pA]);
}
else
{
SendClientMessage(playerid, -1, "You have selected not to go back where you died.");
return 1;
}
}
return 1;
}
public OnPlayerConnect(playerid)
{
IsSpawnAfterDeath[playerid] = 0;
return 1;
}