23.10.2011, 12:09
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
// printf("OnPlayerDeath: playerid: %d, killerid: %d, reason: %s", playerid, killerid, reason); //debug
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);
}
I got a /acceptdeath system, but in my server script when you die you will spawn at the Hospital Automatically, that's what I want to edit..
To make it as acceptdeath system, that you will spawn at Hospital if you do /acceptdeath not if you got killed by someone, it will send you automatically
2nd Question:
In my server script when you pay something like Pay and Spray or Tolls they will took $100 (Pay n' spray), $50 (Toll) but that's bugged because you will get back what you paid.. and I want to make it that if you paid $100 then you will lose $100 from your Cash Bar..