03.11.2010, 21:53
(
Последний раз редактировалось The_Gangstas; 05.11.2010 в 22:11.
)
when i die from this, other players see me die but im actually dead cus onplayerspawn doesnt get recalled..
all the prints do complete..
edit. i kinda fixed it, but now the player drops then gets bac up waits 2 seconds then dies. and sometimes doesnt respawn at all..
all the prints do complete..
edit. i kinda fixed it, but now the player drops then gets bac up waits 2 seconds then dies. and sometimes doesnt respawn at all..
pawn Код:
stock ResetVarsAfterDeath(playerid)
{
Kidnapped[playerid] = 0;
Kidnapping[playerid] =0;
UsedATMRecently[playerid] = 0;
UsedStoreRecently[playerid] = 0;
UsedBarRecently[playerid] = 0;
UsedBankRecently[playerid] = 0;
UsedAmmuRecently[playerid]= 0;
UsedZipRecently[playerid]=0;
UsedBincoRecently[playerid]=0;
UsedSexShopRecently[playerid] = 0;
UsedFishingShopRecently[playerid] = 0;
UsedCasinoRecently[playerid] = 0;
UsedTattooRecently[playerid] = 0;
HasSTDSwineFlu[playerid] =0;
PlayerIDKidnapped[playerid] =-1;
HasSTDSwineFlu[playerid] = 0;
HasSTDGonorrhea[playerid] = 0;
HasSTDSyphilis[playerid] = 0;
HasSTDMadCow[playerid] = 0;
FartRNT[playerid] = 0;
PlayerHasReceivedATicket[playerid] = 0;
PlayerInfo[playerid][LastVeh] = 0;
PlayerInfo[playerid][IsCuffed] = 0;
PlayerInfo[playerid][SeedPlanted] = 0;
PlayerInfo[playerid][PickupableDrugs] = 0;
god[playerid] = 0;
godcar[playerid] = 0;
BribeTo[playerid] = 0;
Bribe[playerid] = 0;
BribeFrom[playerid] = 0;
KillTimer(timer1);
KillTimer(timer2);
TextDrawHideForPlayer(playerid,txtAdvert[playerid]);
TextDrawHideForPlayer(playerid,txtAdvert2[playerid]);
TextDrawHideForPlayer(playerid,txtAdvert3[playerid]);
gPlayerUsingLoopingAnim[playerid] = 0;
IsOnePlayAnim[playerid] = 0;
BackOut[playerid] = 0;
PlayerInfo[playerid][FishedRecently] = 0;
FiredAShotInPublic[playerid]=0;
AttemptEscapedFromJailRecently[playerid]=0;
CuffedSomeoneRecently[playerid]=0;
PlayerInfo[playerid][Trucking]=0;
//Refueling[playerid]=0;
PlayerInfo[playerid][DriverDuty]=0;
PlayerInfo[playerid][DriverFare]=0;
PlayerInfo[playerid][DeliveryTimer]=0;
PlayerInfo[playerid][MissionX]=0;
PlayerInfo[playerid][MissionY]=0;
PlayerInfo[playerid][MissionZ]=0;
PlayerInfo[playerid][Lastx]=0;
PlayerInfo[playerid][Lasty]=0;
PlayerInfo[playerid][Lastz]=0;
PlayerInfo[playerid][BettedRecently]=0;
printf("Vars Worked");
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
print("OnPlayerDeathStarted");
ClearAnimations(playerid);
SendDeathMessage(killerid, playerid, reason);
ResetVarsAfterDeath(playerid);
SetPlayerWantedLevel(playerid, 0);
IsSpawned[playerid] = 0;
RelKidnapPlayer(playerid,PlayerIDKidnapped[playerid],3);
PlayerInfo[playerid][Deaths]++;
print("OnPlayerDeath1");
if(KilledHimself[playerid] == 1){KilledHimself[playerid] =0,killerid=-1;}
if(Joined[playerid] == true)
{
JoinCount--;
Joined[playerid] = false;
DestroyVehicle(CreatedRaceVeh[playerid]);
DisablePlayerRaceCheckpoint(playerid);
TextDrawHideForPlayer(playerid, RaceInfo[playerid]);
CPProgess[playerid] = 0;
KillTimer(InfoTimer[playerid]);
#if defined RACE_IN_OTHER_WORLD
SetPlayerVirtualWorld(playerid, 0);
#endif
}
if(BuildRace == playerid+1) BuildRace = 0;
/*if(killerid == INVALID_PLAYER_ID && reason != 38 && reason != 50 && reason != 51 && reason != 53 && reason != 54 && DiedFromRape[playerid] != 1)
{
//SendClientMessage(playerid,YELLOW,"Unfair Death.");
}*/
if(killerid != INVALID_PLAYER_ID && !IsPlayerNPC(playerid))
{
PlayerInfo[killerid][Kills]++;
if(PlayerInfo[playerid][LifeInsurance] == 1)
{
for (new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, Weapons[playerid][i], Ammo[playerid][i]);
}
SendClientMessage(playerid,YELLOW,"Life Insured. Your Weapons Has Not Been Lost.");
}
if(PlayerInfo[playerid][HealthInsurance] >= 1)
{
printf("OnPlayerDeath: Health Insurance:%s(%d)",Playername(playerid),playerid);
SetSpawnInfo(playerid,GetPlayerTeam(playerid),GetPlayerSkin(playerid),1607.3829,1815.5632,10.8203,10.40,27,500,29,500,31,500);
PlayerInfo[playerid][HealthInsurance] =-1;
SendClientMessage(playerid,YELLOW,"You Were Health Insured, You Have Not Been Charged Any Medical Fee's.");
}
else if(PlayerInfo[playerid][HealthInsurance] == 0)
{
new mbill = random(5000);
if(GovernmentShare <= 5000)
{
mbill+=GovernmentShare;
}
new account = PlayerInfo[playerid][Money];
new Tax=0,TaxValue = 150;
if(account >= 0 && account <= 50000)
{
Tax = TaxValue;
}
if(account >= 50000 && account <= 80000)
{
Tax = TaxValue*2;
}
if(account >= 80000 && account <= 100000)
{
Tax = TaxValue*3;
}
if(account >= 100000 && account <= 300000)
{
Tax = TaxValue*4;
}
if(account >= 300000 && account <= 500000)
{
Tax = TaxValue*5;
}
if(account >= 500000 && account <= 700000)
{
Tax = TaxValue*6;
}
if(account >= 700000 && account <= 1000000)
{
Tax = TaxValue*7;
}
if(account >= 1000000 && account <= 10000000)
{
Tax = TaxValue*8;
}
mbill+=Tax;
new str[75];
format(str,sizeof(str),"~w~Continuing Current Life...~n~~p~Paid Medical Fees $%d",mbill);
GameTextForPlayer(playerid,str,3000,3);
if(PlayerInfo[playerid][Money] <= -1)
{
//SetPlayerHealth(playerid,0);
ForceClassSelection(playerid);
SendClientMessage(playerid,RED,"Unable To Pay Medical Fees...Losing Current Life.");
return 1;
}
if(PlayerInfo[playerid][Money] < mbill)
{
GameTextForPlayer(playerid,"~w~Unable To Pay ~p~Medical Fees~r~...~w~Losing Current Life.",3000,3);
ForceClassSelection(playerid);
return 1;
}
PlayerInfo[playerid][Money]-=mbill;
}
if(PlayerInfo[killerid][Kills] == 1 && PlayerInfo[playerid][pAchievement1] == 0)
{
PlayerInfo[playerid][pAchievement1] = 1;
GameTextForPlayer(killerid, "~w~New ~g~Achievement Unlocked~n~~y~`Kill One Person`!", 7000, 3);
new Admsg[128];
format(Admsg,sizeof(Admsg),"12Server:%s(%d) Has Just Unlocked A New Achievement! `Kill 1 People On The Server!`",Playername(killerid),killerid);
IRC_GroupSay(gGroupID,IRC_CHANNEL,Admsg);
/*format(Admsg,sizeof(Admsg),"~b~~h~%s(%d) Has Just Unlocked A New Achievement! `Kill 1 Person On The Server`",Playername(playerid),playerid);
AddAdvertToAll(Admsg);*/
}
if(PlayerInfo[killerid][Kills] == 10 && PlayerInfo[playerid][pAchievement2] == 0)
{
new Admsg[128];
PlayerInfo[playerid][pAchievement2] = 1;
GameTextForPlayer(killerid, "~w~New ~g~Achievement Unlocked~n~~y~`Kill 10 People`!", 7000, 3);
format(Admsg,sizeof(Admsg),"12Server:%s(%d) Has Just Unlocked A New Achievement! `Kill 10 People On The Server!`",Playername(killerid),killerid);
IRC_GroupSay(gGroupID,IRC_CHANNEL,Admsg);
SendClientMessageToAll(ROYALBLUE,Admsg[2]);
}
if(DiedFromRape[playerid] != 1 && gTeam[killerid] == TEAM_CIVILIAN && HasHitOnHim[playerid] == 0)
{
new string[128];
format(string, sizeof(string), "Crime In Progress. Suspect: %s(%d) - Crime: Cold Blooded Murder - Location:%s.",Playername(killerid),killerid,GetPlayerArea(killerid));
CopRadio(ROYALBLUE,string);
PlayCrimeReportForAllCops(killerid,17);
PlayCrimeReportForPlayer(killerid,killerid,17);
SetPlayerWantedLevel(killerid,GetPlayerWantedLevel(killerid)+3);
SendClientMessageFormatted(killerid,GetPlayerColor(killerid),"Commited A Crime: Cold Blooded Murder - Wanted Level: %d",GetPlayerWantedLevel(killerid));
}
if(HasHitOnHim[playerid] >=1 && PlayerInfo[killerid][Hitman] == 1)
{
new string[128];
new plwl = GetPlayerWantedLevel(killerid);
new pcol = GetPlayerColor(killerid);
SetPlayerWantedLevel(killerid,plwl +10);
plwl = GetPlayerWantedLevel(killerid);
format(string, sizeof(string), "Server:%s(%d) Has Been Killed By %s(%d) For A Hit Contract Of $%d Reason:%s",Playername(playerid),playerid,Playername(killerid),killerid,HitmanPrice[playerid],HitmanReason[playerid]);
SendClientMessageToAll(COLOR_LOC,string);
IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
format(string, sizeof(string), "You Have Killed %s(%d) For A Hit Contract. You Receive Your Payment, $%d",Playername(playerid),playerid,HitmanPrice[playerid]);
SendClientMessage(killerid,pcol,string);
PlayerInfo[killerid][Money] += HitmanPrice[playerid];
HasHitOnHim[playerid] =0;
HitmanPrice[playerid] =0;
HitmanReason[playerid] ="None";
}
if(gTeam[playerid] == TEAM_COPS && gTeam[killerid] == TEAM_COPS)
{
new string[128];
SetPlayerScore(killerid, GetPlayerScore(killerid)-1);
SendClientMessage(killerid,0xFF0000FF,"Don't Kill Your Own Team Members!");
format(string, sizeof(string), "Officer %s(%d) Has Been Jailed For Team Killing", Playername(killerid),killerid);
SendClientMessageToAll(TEAL, string);
SetPlayerJailed(killerid, true);
PlayerInfo[killerid][PrisonTime] = 115;
new spawn = random(sizeof(PrisonSpawn));
SetPlayerPos(killerid, PrisonSpawn[spawn][0], PrisonSpawn[spawn][1], PrisonSpawn[spawn][2]);
SetPlayerFacingAngle(killerid, PrisonSpawn[spawn][3]);
SetCameraBehindPlayer(killerid);
SetPlayerInterior(killerid,3);
}
if(gTeam[playerid] == TEAM_UNDERCOVERCIA && gTeam[killerid] == TEAM_UNDERCOVERCIA)
{
new string[128];
SetPlayerScore(killerid, GetPlayerScore(killerid)-1);
SendClientMessage(killerid,0xFF0000FF,"Don't Kill Your Own Team Members!");
format(string, sizeof(string), "UndercoverCia Agent %s(%d) Has Been Jailed For Team Killing", Playername(killerid),killerid);
SendClientMessageToAll(TEAL, string);
new spawn = random(sizeof(PrisonSpawn));
SetPlayerPos(killerid, PrisonSpawn[spawn][0], PrisonSpawn[spawn][1], PrisonSpawn[spawn][2]);
SetPlayerJailed(killerid, true);
PlayerInfo[killerid][PrisonTime] = 115;
}
}
print("OnPlayerDeath2");
/*if(gTeam[playerid] == TEAM_CIVILIAN && gTeam[killerid] == TEAM_COPS)
{
new string[128];
if(GetPlayerWantedLevel(playerid) >= 1 && GetPlayerWantedLevel(playerid) <= 3)
{
SendClientMessage(killerid,RED,"Do Not Kill Suspected People! Only Kill With-In Self Defense!");
SetPlayerScore(killerid, GetPlayerScore(killerid)-1);
SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
PlayerInfo[killerid][Money] -= 5000;
}
if(GetPlayerWantedLevel(playerid) >= 4 && GetPlayerWantedLevel(playerid) <= 5)
{
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
format(string, sizeof(string), "Suspect %s(%d) Has Been Taken Down By Officer %s(%d)",Playername(playerid),playerid,Playername(killerid),killerid);
SendClientMessageToAll(0x80FF00FF,string);
SendClientMessage(killerid,0xFFCC00FF,"You Have Taken Down A Player With A Level 4-5 Wanted Level! You Recieve A Bonus Of 10000!");
PlayerInfo[killerid][Money] -= 2000;
new spawn = random(sizeof(PrisonSpawn));
SetPlayerPos(killerid, PrisonSpawn[spawn][0], PrisonSpawn[spawn][1], PrisonSpawn[spawn][2]);
PlayerInfo[playerid][PrisonTime] = 75;
SetPlayerJailed(playerid, true);
}
if(GetPlayerWantedLevel(playerid) >= 6)
{
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
format(string, sizeof(string), "The Most Wanted %s(%d) Has Been Taken Down By Officer %s(%d)",Playername(playerid),playerid,Playername(killerid),killerid);
SendClientMessageToAll(0x80FF00FF,string);
SendClientMessage(killerid,GREEN,"You Have Taken Down A Player With A Level 6 Wanted Level! You Recieve A Bonus Of 15000!");
PlayerInfo[killerid][Money] -= 5000;
PlayerInfo[playerid][PrisonTime] = 120;
SetPlayerJailed(playerid, true);
}
}*/
print("OnPlayerDeath3");
new
msg[128],
killerName[MAX_PLAYER_NAME],
reasonMsg[32],
playerName[MAX_PLAYER_NAME];
GetPlayerName(killerid, killerName, sizeof(killerName));
GetPlayerName(playerid, playerName, sizeof(playerName));
if (killerid != INVALID_PLAYER_ID)
{
switch (reason)
{
case 0:
{
reasonMsg = "Unarmed";
}
case 1:
{
reasonMsg = "Brass Knuckles";
}
case 2:
{
reasonMsg = "Golf Club";
}
case 3:
{
reasonMsg = "Night Stick";
}
case 4:
{
reasonMsg = "Knife";
}
case 5:
{
reasonMsg = "Baseball Bat";
}
case 6:
{
reasonMsg = "Shovel";
}
case 7:
{
reasonMsg = "Pool Cue";
}
case 8:
{
reasonMsg = "Katana";
}
case 9:
{
reasonMsg = "Chainsaw";
}
case 10:
{
reasonMsg = "Dildo";
}
case 11:
{
reasonMsg = "Dildo";
}
case 12:
{
reasonMsg = "Vibrator";
}
case 13:
{
reasonMsg = "Vibrator";
}
case 14:
{
reasonMsg = "Flowers";
}
case 15:
{
reasonMsg = "Cane";
}
case 22:
{
reasonMsg = "Pistol";
}
case 23:
{
reasonMsg = "Silenced Pistol";
}
case 24:
{
reasonMsg = "Desert Eagle";
}
case 25:
{
reasonMsg = "Shotgun";
}
case 26:
{
reasonMsg = "Sawn-off Shotgun";
}
case 27:
{
reasonMsg = "Combat Shotgun";
}
case 28:
{
reasonMsg = "MAC-10";
}
case 29:
{
reasonMsg = "MP5";
}
case 30:
{
reasonMsg = "AK-47";
}
case 31:
{
if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER) {
switch (GetVehicleModel(GetPlayerVehicleID(killerid))) {
case 447:
{
reasonMsg = "Sea Sparrow Machine Gun";
}
default:
{
reasonMsg = "M4";
}
}
}
else {
reasonMsg = "M4";
}
}
case 32:
{
reasonMsg = "TEC-9";
}
case 33:
{
reasonMsg = "Rifle";
}
case 34:
{
reasonMsg = "Sniper Rifle";
}
case 37:
{
reasonMsg = "Fire";
}
case 38:
{
if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER) {
switch (GetVehicleModel(GetPlayerVehicleID(killerid))) {
case 425:
{
reasonMsg = "Hunter Machine Gun";
}
default:
{
reasonMsg = "Minigun";
}
}
}
else {
reasonMsg = "Minigun";
}
}
case 41:
{
reasonMsg = "Spraycan";
}
case 42:
{
reasonMsg = "Fire Extinguisher";
}
case 43:
{
reasonMsg = "Camera";
}
case 46:
{
reasonMsg = "Parachute";
}
case 49:
{
reasonMsg = "Vehicle Collision";
}
case 50:
{
if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER) {
switch (GetVehicleModel(GetPlayerVehicleID(killerid))) {
case 417, 425, 447, 465, 469, 487, 488, 497, 501, 548, 563:
{
reasonMsg = "Helicopter Blades";
}
default:
{
reasonMsg = "Vehicle Collision";
}
}
}
else {
reasonMsg = "Vehicle Collision";
}
}
case 51:
{
if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER) {
switch (GetVehicleModel(GetPlayerVehicleID(killerid))) {
case 425:
{
reasonMsg = "Hunter Rockets";
}
case 432:
{
reasonMsg = "Rhino Turret";
}
case 520:
{
reasonMsg = "Hydra Rockets";
}
default:
{
reasonMsg = "Explosion";
}
}
}
else {
reasonMsg = "Explosion";
}
}
default:
{
reasonMsg = "Unknown";
}
}
format(msg, sizeof(msg), "Server:%s(%d) Killed %s(%d). Reason: %s", killerName,killerid, playerName,playerid, reasonMsg);
}
else {
switch (reason) {
case 53:
{
format(msg, sizeof(msg), "%s(%d) Has Died, Reason: Drowned", playerName,playerid);
}
case 54:
{
format(msg, sizeof(msg), "%s(%d) Has Died, Reason: Collision", playerName,playerid);
}
default:
{
format(msg, sizeof(msg), "%s(%d) Has Died, Reason: Unknown", playerName,playerid);
}
}
}
IRC_GroupSay(gGroupID, IRC_CHANNEL, msg);
print("OnPlayerDeath Successfully Called");
GivePlayerWeapon(playerid, 16, 25);
GivePlayerWeapon(playerid, 4, 1);
GivePlayerWeapon(playerid, 27, 650);
return 1;
}