13.05.2014, 04:45
My onplayerdeath does not send any death message and client message if the killerid =INVALID_PLAYER_ID
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
if(aduty[killerid] == 1 && killerid != INVALID_PLAYER_ID) return GameTextForPlayer(playerid,"~r~Unfair Death",4000,3);
new msg[128], killerName[MAX_PLAYER_NAME], reasonMsg[32], playerName[MAX_PLAYER_NAME];
GetPlayerName(killerid, killerName, sizeof(killerName));
GetPlayerName(playerid, playerName, sizeof(playerName));
HideAllServerTextDraws(playerid);
SetPlayerColor(killerid, COLOR_ORANGERED);
ad_recent1[playerid] =0;
KillTimer(ad_timer1[playerid]);
pInfo[playerid][DrugTime]=0;
if (killerid != INVALID_PLAYER_ID)
{
if(randomid == playerid)
{
new str1[200];
randomid = -1;
new str2[200];
format(str2, sizeof(str2),"~p~~h~%s (%d) ~w~Has Killed The ~g~Bonus~w~ Player ~p~~h~%s (%d) ~w~And Won ~g~~h~$%d.",killerName, killerid, playerName, playerid, randmoney);
TextDrawSetString(Textdraw111, str2);
TextDrawShowForAll(Textdraw111);
new Miney = pInfo[killerid][Money];
pInfo[killerid][Money] =Miney+randmoney;
format(str1, sizeof(str1),"* {00B9FF}%s (%d) {FFFFFF}Has Killed The Bonus Player {00B9FF}%s (%d) {FFFFFF}And Won {73FF00}$%d.",killerName, killerid, playerName, playerid, randmoney);
SCMA(COLOR_ORANGE, str1);
randmoney =0;
}
pInfo[killerid][Kills]++;
pInfo[playerid][Deaths]++;
new WantedLevel = GetPlayerWantedLevel(killerid);
if(WantedLevel == 0)
{
SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid) + 4);
SCM(killerid,COLOR_ORANGE,"Committed A Crime (Murder) - Wanted Level 6 - Felon - Warrant Issued");
}
if(WantedLevel == 4)
{
SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid) + 1);
SCM(killerid,COLOR_ORANGE,"Committed A Crime (Murder) - Wanted Level 8 - Felon - Warrant Issued");
SetPlayerColor(killerid, COLOR_MUDER);
}
if(WantedLevel == 5)
{
SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid) + 1);
SCM(killerid,COLOR_ORANGE,"Committed A Crime (Murder) - Wanted Level 9 - Most Wanted - Warrant Issued");
SetPlayerColor(killerid, COLOR_MOSTWANTED);
}
if(WantedLevel == 6)
{
SCM(killerid,COLOR_ORANGE,"Committed A Crime (Murder) - Wanted Level 10 - Most Wanted - Warrant Issued");
SetPlayerColor(killerid, COLOR_MOSTWANTED);
}
SendDeathMessage(killerid, playerid, reason);
if(InDuel[playerid] == 1)
{
new string[256];
if(DuelCage1 == playerid || DuelCage1 == killerid)
{
Inventation[playerid] = -1;
InventationSent[playerid] = -1;
Inventation[killerid] = -1;
InventationSent[killerid] = -1;
InDuel[playerid] = 0;
InDuel[killerid] = 0;
format(string, sizeof(string), "[DUEL] %s (%d) Has Won Duel Against %s (%d) And Won "GREEN"$%d", killerName, killerid, playerName, playerid, DuelCage1price);
SCMA(COLOR_SKYBLUE, string);
new Miney = pInfo[killerid][Money];
pInfo[killerid][Money] =Miney+DuelCage1price*2;
DuelCage1 = -1;
return 1;
}
if(DuelCage2 == playerid || DuelCage2 == killerid)
{
Inventation[playerid] = -1;
InventationSent[playerid] = -1;
Inventation[killerid] = -1;
InventationSent[killerid] = -1;
InDuel[playerid] = 0;
InDuel[killerid] = 0;
format(string, sizeof(string), "[DUEL] %s (%d) Has Won Duel Against %s (%d) And Won "GREEN"$%d", killerName, killerid, playerName, playerid, DuelCage2price);
SCMA(COLOR_SKYBLUE, string);
new Miney = pInfo[killerid][Money];
pInfo[killerid][Money] =Miney+DuelCage2price*2;
DuelCage2 = -1;
return 1;
}
if(DuelCage3 == playerid || DuelCage3 == killerid)
{
Inventation[playerid] = -1;
InventationSent[playerid] = -1;
Inventation[killerid] = -1;
InventationSent[killerid] = -1;
InDuel[playerid] = 0;
InDuel[killerid] = 0;
format(string, sizeof(string), "[DUEL] %s (%d) Has Won Duel Against %s (%d) And Won "GREEN"$%d", killerName, killerid, playerName, playerid, DuelCage3price);
SCMA(COLOR_SKYBLUE, string);
new Miney = pInfo[killerid][Money];
pInfo[killerid][Money] =Miney+DuelCage3price*2;
DuelCage3 = -1;
return 1;
}
if(DuelCage4 == playerid || DuelCage4 == killerid)
{
Inventation[playerid] = -1;
InventationSent[playerid] = -1;
Inventation[killerid] = -1;
InventationSent[killerid] = -1;
InDuel[playerid] = 0;
InDuel[killerid] = 0;
format(string, sizeof(string), "[DUEL] %s (%d) Has Won Duel Against %s (%d) And Won "GREEN"$%d", killerName, killerid, playerName, playerid, DuelCage4price);
SCMA(COLOR_SKYBLUE, string);
new Miney = pInfo[killerid][Money];
pInfo[killerid][Money] =Miney+DuelCage4price*2;
DuelCage4 = -1;
return 1;
}
return 1;
}
KillStreak[killerid] ++;
new Miney = pInfo[killerid][Money];
pInfo[killerid][Money] =Miney+500*2;
SetPlayerWantedLevel(playerid, 0);
KillStreak[playerid] = 0;
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
new str[256];
switch(KillStreak[killerid])
{
case 2: format(str, sizeof(str), "~g~%s has performed a ~y~double kill!", killerName);
case 3: format(str, sizeof(str), "~y~Triple Kill for ~b~%s!", killerName);
case 4: format(str, sizeof(str), "~p~Fourth Kill for ~r~%s!", killerName);
case 5: format(str, sizeof(str), "~r~%s is dominating with ~p~five kills!", killerName);
case 6: format(str, sizeof(str), "~w~%s is epic !! Imagine that !! ~y~six kills!", killerName);
case 7: format(str, sizeof(str), "~r~Epic luck for %s with ~w~seven kills!", killerName);
case 8: format(str, sizeof(str), "~p~%s is Amazing Killer with ~y~eight kills!", killerName);
case 9: format(str, sizeof(str), "~g~%s is Profesional !! ~b~nine kills!", killerName);
case 10: format(str, sizeof(str), "~b~%s is annihilating ! ~g~ten kills!", killerName);
case 11: format(str, sizeof(str), "~b~%s Nigga ~P~~H~is on ~R~~H~Fire ! ~g~eleven kills!", killerName);
case 12: format(str, sizeof(str), "~b~~H~ This is totally ~G~~H~shit ! ~g~%s twelve kills!", killerName);
case 13: format(str, sizeof(str), "~g~~H~ Has Fucked you ~G~~H~ALL ! ~g~%s thirteen kills!", killerName);
case 14: format(str, sizeof(str), "~g~~H~Aim ~R~Botter ! ~g~%s fourteen kills!", killerName);
case 15: format(str, sizeof(str), "~r~~H~%s in Offically an ~g~~h~Hacker ! ~g~ fifteen kills!", killerName);
}
if(KillStreak[killerid] == 2)
{
pInfo[killerid][Money] =Miney+5000;
new stringg[500];
format(stringg,sizeof(stringg),"You Recive "GREEN"$5000"SKYBLUE"For Your %d Kills",KillStreak[killerid]);
SCM(killerid,COLOR_SKYBLUE,stringg);
}
if(KillStreak[killerid] == 3)
{
pInfo[killerid][Money] =Miney+6000;
new stringg[500];
format(stringg,sizeof(stringg),"You Recive "GREEN"$6000"SKYBLUE"For Your %d Kills",KillStreak[killerid]);
SCM(killerid,COLOR_SKYBLUE,stringg);
}
if(KillStreak[killerid] == 3)
{
pInfo[killerid][Money] =Miney+7000;
new stringg[500];
format(stringg,sizeof(stringg),"You Recive "GREEN"$7000"SKYBLUE"For Your %d Kills",KillStreak[killerid]);
SCM(killerid,COLOR_SKYBLUE,stringg);
}
if(KillStreak[killerid] == 4)
{
pInfo[killerid][Money] =Miney+8000;
new stringg[500];
format(stringg,sizeof(stringg),"You Recive "GREEN"$8000"SKYBLUE"For Your %d Kills",KillStreak[killerid]);
SCM(killerid,COLOR_SKYBLUE,stringg);
}
if(KillStreak[killerid] == 5)
{
pInfo[killerid][Money] =Miney+9000;
new stringg[500];
format(stringg,sizeof(stringg),"You Recive "GREEN"$9000"SKYBLUE"For Your %d Kills",KillStreak[killerid]);
SCM(killerid,COLOR_SKYBLUE,stringg);
}
if(KillStreak[killerid] == 6)
{
pInfo[killerid][Money] =Miney+10000;
new stringg[500];
format(stringg,sizeof(stringg),"You Recive "GREEN"$10000"SKYBLUE"For Your %d Kills",KillStreak[killerid]);
SCM(killerid,COLOR_SKYBLUE,stringg);
}
if(KillStreak[killerid] == 7)
{
pInfo[killerid][Money] =Miney+11000;
new stringg[500];
format(stringg,sizeof(stringg),"You Recive "GREEN"$11000"SKYBLUE"For Your %d Kills",KillStreak[killerid]);
SCM(killerid,COLOR_SKYBLUE,stringg);
}
if(KillStreak[killerid] == 8)
{
pInfo[killerid][Money] =Miney+12000;
new stringg[500];
format(stringg,sizeof(stringg),"You Recive "GREEN"$12000"SKYBLUE"For Your %d Kills",KillStreak[killerid]);
SCM(killerid,COLOR_SKYBLUE,stringg);
}
if(KillStreak[killerid] == 9)
{
pInfo[killerid][Money] =Miney+13000;
new stringg[500];
format(stringg,sizeof(stringg),"You Recive "GREEN"$13000"SKYBLUE"For Your %d Kills",KillStreak[killerid]);
SCM(killerid,COLOR_SKYBLUE,stringg);
}
if(KillStreak[killerid] == 10)
{
pInfo[killerid][Money] =Miney+14000;
new stringg[500];
format(stringg,sizeof(stringg),"You Recive "GREEN"$14000"SKYBLUE"For Your %d Kills",KillStreak[killerid]);
SCM(killerid,COLOR_SKYBLUE,stringg);
}
if(KillStreak[killerid] == 11)
{
pInfo[killerid][Money] =Miney+14000;
new stringg[500];
format(stringg,sizeof(stringg),"You Recive "GREEN"$14000"SKYBLUE"For Your %d Kills",KillStreak[killerid]);
SCM(killerid,COLOR_SKYBLUE,stringg);
}
if(KillStreak[killerid] == 12)
{
pInfo[killerid][Money] =Miney+15000;
new stringg[500];
format(stringg,sizeof(stringg),"You Recive "GREEN"$15000"SKYBLUE"For Your %d Kills",KillStreak[killerid]);
SCM(killerid,COLOR_SKYBLUE,stringg);
}
if(KillStreak[killerid] == 13)
{
pInfo[killerid][Money] =Miney+16000;
new stringg[500];
format(stringg,sizeof(stringg),"You Recive "GREEN"$16000"SKYBLUE"For Your %d Kills",KillStreak[killerid]);
SCM(killerid,COLOR_SKYBLUE,stringg);
}
if(KillStreak[killerid] == 14)
{
pInfo[killerid][Money] =Miney+17000;
new stringg[500];
format(stringg,sizeof(stringg),"You Recive "GREEN"$17000"SKYBLUE"For Your %d Kills",KillStreak[killerid]);
SCM(killerid,COLOR_SKYBLUE,stringg);
}
if(KillStreak[killerid] == 15)
{
pInfo[killerid][Money] =Miney+18000;
new stringg[500];
format(stringg,sizeof(stringg),"You Recive "GREEN"$18000"SKYBLUE"For Your %d Kills",KillStreak[killerid]);
SCM(killerid,COLOR_SKYBLUE,stringg);
}
GameTextForAll(str,3000,3);
new wepname[32];
GetWeaponName(reason, wepname, sizeof(wepname));
SendClientMessageToAll(COLOR_MAROON, msg);
SetPlayerWantedLevel(playerid, 0);
if(challenge[playerid] == 1)
{
new stringc[256], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(stringc, sizeof(stringc), "%s (%d) Got Killed In Sniper Death Match By %s (%d)", pname,playerid,killerName,killerid);
SCMA(COLOR_MAROON, stringc);
}
if(dms[playerid] == 1)
{
new stringc[256], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(stringc, sizeof(stringc), "%s (%d) got killed in a Death Match Stadium by %s (%d)", playerName,playerid,killerName,killerid);
SCMA(COLOR_MAROON, stringc);
}
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: reasonMsg = "M4";
case 32: reasonMsg = "TEC-9";
case 33: reasonMsg = "Country Rifle";
case 34: reasonMsg = "Sniper Rifle";
case 37: reasonMsg = "Fire";
case 38: reasonMsg = "Minigun";
case 41: reasonMsg = "Spray Can";
case 42: reasonMsg = "Fire Extinguisher";
case 49: reasonMsg = "Vehicle Collision";
case 50: reasonMsg = "Vehicle Collision";
case 51: reasonMsg = "Explosion";
default: reasonMsg = "Unknown";
}
format(msg, sizeof(msg), "*%s killed by %s. (%s)", killerName, playerName, reasonMsg);
SendClientMessageToAll(COLOR_MAROON, msg);
}
else
{
switch (reason)
{
case 53: format(msg, sizeof(msg), "*%s died. (Drowned)", playerName);
case 54: format(msg, sizeof(msg), "*%s died. (Collision)", playerName);
default: format(msg, sizeof(msg), "*%s died.", playerName);
}
pInfo[playerid][Deaths]++;
SendDeathMessage(playerid, INVALID_PLAYER_ID, reason);
SendClientMessageToAll(COLOR_MAROON, msg);
if(randomid == playerid)
{
new str1[200];
randomid = -1;
new str2[200];
format(str2, sizeof(str2),"~g~Bonus Player ~p~~h~%s (%d) ~w~Has ~r~died ~w~in an ~y~Accident.", playerName, playerid);
TextDrawSetString(Textdraw111, str2);
TextDrawShowForAll(Textdraw111);
format(str1, sizeof(str1),"* Bonus: {00B9FF}%s (%d) {FFFFFF}Has Been Died In An Accident.", playerName, playerid);
SCMA(COLOR_ORANGE, str1);
randmoney =0;
}
}
SetPlayerColor(playerid, COLOR_GREY);
PlayerDuelWatching[playerid] = 0;
Anti_heal[playerid] = 0;
spawned[playerid] =0;
AUTO_SAVE(playerid);
AUTO_SAVE(killerid);
aduty[playerid] =0;
return 1;
}