23.10.2011, 13:48
Hmm, this is for the /acceptdeath system. Not sure about the Pay n Spray problem you have.
Not 100% sure if it will work, try it:
Not 100% sure if it will work, try it:
pawn Код:
// top of script
new OfferedDeath[MAX_PLAYERS];
// onplayerspawn
if(OfferedDeath[playerid] == 1)
{
return SendClientMessage(playerid,-1,"You Have Been Offered To Be Taken To The Hospital. Type /acceptdeath To Accept This.");
}
// /acceptdeath command
if(OfferedDeath[playerid] == 1)
{
SendClientMessage(playerid,-1,"You Are Now At The Hospital. Please Wait For Further Assistance ...");
// hospital stuff
// hospital stuff etc ...
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
// printf("OnPlayerDeath: playerid: %d, killerid: %d, reason: %s", playerid, killerid, reason); //debug
OfferedDeath[playerid] = 1; // when they die, they will be offered /acceptdeath on spawn
ClearGuns(playerid);
SetPlayerColor(playerid, TCOLOR_HOSPITAL);
GameTextForPlayer(playerid,"~w~Wasted",4000,2);
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pOnDuty] = 0;
PlayerInfo[playerid][pBombs] = 0;
PlayerInfo[playerid][pScope] = 0;
PlayerInfo[playerid][pLocal] = 999;
PlayerInfo[playerid][pVirtualWorld] = 0;
PlayerInfo[killerid][pKills] += 1;
CapturingTimer[playerid] = 0;
STDPlayer[playerid] = 0;
IsAtEvent[playerid] = 0;
new name[MAX_PLAYER_NAME];
new killa[MAX_PLAYER_NAME];
new deathreason[25];
new string[128];
new caller = Mobile[playerid];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(killerid, killa, sizeof(killa));
if(RobStatus[Setup] == 1 && RobStatus[BeingRobbed] == 0 && RobStatus[RobberID1] == playerid)
{
RobStatus[Setup] = 0;
SendClientMessage(RobStatus[RobberID1], COLOR_YELLOW, "** The Robbing Leader has died, robbery over");
SendClientMessage(RobStatus[RobberID2], COLOR_YELLOW, "** The Robbing Leader has died, robbery over");
SendClientMessage(RobStatus[RobberID3], COLOR_YELLOW, "** The Robbing Leader has died, robbery over");
SendClientMessage(RobStatus[RobberID4], COLOR_YELLOW, "** The Robbing Leader has died, robbery over");
SendClientMessage(RobStatus[RobberID5], COLOR_YELLOW, "** The Robbing Leader has died, robbery over");
RobStatus[RobberID1] = 255;
RobStatus[RobberID2] = 255;
RobStatus[RobberID3] = 255;
RobStatus[RobberID4] = 255;
RobStatus[RobberID5] = 255;
}
if(PlayerInfo[playerid][Robbing] == 1)
{
if(RobStatus[RobberID1] == playerid)
{
RobStatus[RobberID1] = 200;
if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
{
RobStatus[BeingRobbed] = 0;
RobStatus[BankReload] = 6; // Can't be robbed for 2 hours
RobStatus[Setup] = 0;
SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished");
FinishRobbery();
}
}
if(RobStatus[RobberID2] == playerid)
{
RobStatus[RobberID2] = 200;
if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
{
RobStatus[BeingRobbed] = 0;
RobStatus[BankReload] = 6; // Can't be robbed for 2 hours
RobStatus[Setup] = 0;
SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished");
FinishRobbery();
}
}
if(RobStatus[RobberID3] == playerid)
{
RobStatus[RobberID3] = 200;
if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
{
RobStatus[BeingRobbed] = 0;
RobStatus[BankReload] = 6; // Can't be robbed for 2 hours
RobStatus[Setup] = 0;
SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished");
FinishRobbery();
}
}
if(RobStatus[RobberID4] == playerid)
{
RobStatus[RobberID4] = 200;
if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
{
RobStatus[BeingRobbed] = 0;
RobStatus[BankReload] = 6; // Can't be robbed for 2 hours
RobStatus[Setup] = 0;
SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished");
FinishRobbery();
}
}
if(RobStatus[RobberID5] == playerid)
{
RobStatus[RobberID5] = 200;
if(RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
{
RobStatus[BeingRobbed] = 0;
RobStatus[BankReload] = 6; // Can't be robbed for 2 hours
RobStatus[Setup] = 0;
SendClientMessageToAll(COLOR_ORANGE, "** The Bank Robbery has finished");
FinishRobbery();
}
}
format(string,sizeof(string),"** You've died and failed to get your money of $%d",PlayerInfo[playerid][CashLoaded]);
SendClientMessage(playerid, COLOR_YELLOW, string);
PlayerInfo[playerid][CashLoaded] = 0;
PlayerInfo[playerid][Robbing] = 0;
DisablePlayerCheckpoint(playerid);
}
if(gPlayerUsingApplyAnim[playerid])
{
gPlayerUsingApplyAnim[playerid] = 0;
TextDrawHideForPlayer(playerid,txtAnimhelper);
}
if (GetPlayerState(playerid) == 1)
{
return 1;
}
TextDrawHideForPlayer(playerid, Textdraw2[playerid]);
TextDrawHideForPlayer(playerid, Textdraw3[playerid]);
if(GetPlayerState(killerid) == 2)
{
new vehicleid = GetPlayerVehicleID(killerid);
if(IsAHelicopter(vehicleid))
{
format(string, sizeof(string), "AdmWarning: %s has killed %s, Bladekilling.",killa,name);
UpdateWarnings(string);
}
if(GetPlayerWeapon(killerid) == 29)
{
format(string, sizeof(string), "AdmWarning: %s has killed %s, Drivershooting.",killa,name);
UpdateWarnings(string);
}
}
if(killerid != INVALID_PLAYER_ID)
{
if(reason == 0) { deathreason = "Melee"; }
else if(reason == 36 || reason == 35 || reason == 40 || reason == 16) { deathreason = "Explosion"; }
else if(reason == 18 || reason == 37) { deathreason = "Fire"; }
else if(reason == 51) { deathreason = "Explosion"; }
else if(reason == 50) { deathreason = "Heli-Kill"; }
else { GetWeaponName(reason, deathreason, sizeof(deathreason)); }
format(string, sizeof(string), "%s(%d) has been killed by %s(%d) using %s",name,playerid,killa,killerid,deathreason);
DeathMessages(playerid,COLOR_YELLOW2,string);
}