CALLBACK:OnPlayerDeath(playerid, killerid, reason)
{
AccInfo[playerid][Spawned] = 0; // Set Spawned to 0
SendDeathMessage(killerid, playerid, reason);
GivePlayerMoney(killerid,100);
new msg[128], KillerPlayerName[MAX_PLAYER_NAME], reasonMsg[64], KilledPlayerName[MAX_PLAYER_NAME];
GetPlayerName(killerid, KillerPlayerName, sizeof(KillerPlayerName));
GetPlayerName(playerid, KilledPlayerName, sizeof(KilledPlayerName));
#if WeaponDrop == true
DropPlayerWeapons(playerid);
#endif
if(AccInfo[playerid][Deathmessages] == 1)
{
if (killerid != INVALID_PLAYER_ID)
{
switch (reason)
{
case 0: reasonMsg = "Hands"/*"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";
}
format(msg,sizeof(msg),"%s (%d) used %s to kill %s (%d) from %.0f metres.", KillerPlayerName, killerid, reasonMsg, KilledPlayerName, playerid, DistanceBetweenPlayers);
SendClientMessageToAll(brown, msg);
}
}
#if USE_STATS == true
AccInfo[playerid][Deaths]++;
#endif
InDuel[playerid] = 0;
if(AccInfo[playerid][pCaged] == 1)
{
cage[playerid] = DestroyObject(cage[playerid]);
cage2[playerid] = DestroyObject(cage2[playerid]);
cage3[playerid] = DestroyObject(cage3[playerid]);
cage4[playerid] = DestroyObject(cage4[playerid]);
}
/*----------------------FOR ASSIST IN KILLING-----------------------------*/
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(i != INVALID_PLAYER_ID && killerid != INVALID_PLAYER_ID)
{
if(assistkill[i] != playerid && assist[i] >= 70)
{
new string[300];
format(string, sizeof(string), ">>"COL_YELLOW"[ASSIST]"COL_ORANGE" You have assisted %s (%d) in killing %s (%d)."COL_YELLOW"Damage Taken: %.2f", PlayerName2(killerid), killerid, PlayerName2(playerid), playerid, assist[i]);
SendClientMessage(assistkill[i], -1, string);
assistkill[i] = INVALID_PLAYER_ID;
assist[i] = 0;
if(assistkill[i] != playerid && assist[i] >= 80)
{
SendClientMessage(assistkill[i], -1, ""COL_ORANGE"• You have recieved $100.");
}
AccInfo[playerid][TotalAssists]++;
}
}
}
/*------------------------------------------------------------------------*/
if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
{
#if USE_STATS == true
AccInfo[killerid][Kills]++;
#endif
//==============================================================================
// In Duel
//==============================================================================
if(InDuel[playerid] == 1 && InDuel[killerid] == 1)
{
GameTextForPlayer(playerid,"Loser!",3000,3);
GameTextForPlayer(killerid,"Winner!",3000,3);
InDuel[killerid] = 0;
SetPlayerPos(killerid, 0.0, 0.0, 0.0);
SpawnPlayer(killerid);
}
else if(InDuel[playerid] == 1 && InDuel[killerid] == 0)
{
GameTextForPlayer(playerid,"Loser !",3000,3);
}
}
//==============================================================================
// Spectate
//==============================================================================
for(new x=0; x<MAX_PLAYERS; x++)
if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && AccInfo[x][SpecID] == playerid)
AdvanceSpectate(x);
return 1;
}
#define CALLBACK: ...
if there are scripts that use OnPlayerDeath and there is return 0; somewhere in the callback change it to return 1;
if not or you still got the same issue show the code |