14.06.2014, 10:08
pawn Код:
#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;
}