public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
new Float:HP;
GetPlayerHealth(playerid, HP);
new Float:Armor;
GetPlayerArmour(playerid, Armor);
TextDrawShowForPlayer(playerid,flash);
SetTimerEx("Flash", 1500, false, "i", playerid);
if(weaponid == 24) SetPlayerArmour(playerid, Armor-15);
if(weaponid == 22) SetPlayerArmour(playerid, Armor-5);
if(weaponid == 23) SetPlayerArmour(playerid, Armor-5);
if(weaponid == 25) SetPlayerArmour(playerid, Armor-20);
if(weaponid == 28) SetPlayerArmour(playerid, Armor-13);
if(weaponid == 29) SetPlayerArmour(playerid, Armor-15);
if(weaponid == 30) SetPlayerArmour(playerid, Armor-7);
if(weaponid == 31) SetPlayerArmour(playerid, Armor-11);
if(weaponid == 33) SetPlayerArmour(playerid, Armor-25);
if(weaponid == 34) SetPlayerArmour(playerid, Armor-28);
if(weaponid == 24) SetPlayerHealth(playerid, HP-40);
if(weaponid == 22) SetPlayerHealth(playerid, HP-27);
if(weaponid == 23) SetPlayerHealth(playerid, HP-26);
if(weaponid == 25) SetPlayerHealth(playerid, HP-30);
if(weaponid == 28) SetPlayerHealth(playerid, HP-15);
if(weaponid == 29) SetPlayerHealth(playerid, HP-20);
if(weaponid == 30) SetPlayerHealth(playerid, HP-30);
if(weaponid == 31) SetPlayerHealth(playerid, HP-35);
if(weaponid == 33) SetPlayerHealth(playerid, HP-40);
if(weaponid == 34) SetPlayerHealth(playerid, HP-80);
if(Rubber[issuerid] == 1)
{
SetPlayerHealth(playerid, HP-0);
SetPlayerArmour(playerid, Armor-0);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
SetTimerEx("AnimRubber", 9500, false, "i", playerid);
return 1;
}
if(DeathState[playerid] == 1)
{
SetPlayerHealth(playerid, 1);
SetPlayerArmour(playerid, 0);
}
if(bodypart == 9)
{
Headwound[playerid]++;
ApplyAnimation(playerid, "ped", "SHOT_partial", 2, 0, 0, 0, 0, 0, 1);
}
if(bodypart == 8)
{
Rightlegwound[playerid]++;
}
if(bodypart == 7)
{
Leftlegwound[playerid]++;
}
if(bodypart == 6)
{
ApplyAnimation(playerid, "ped", "SHOT_rightP", 2, 0, 0, 0, 0, 0, 1);
Rightarmwound[playerid]++;
}
if(bodypart == 5)
{
ApplyAnimation(playerid, "ped", "SHOT_leftP", 2, 0, 0, 0, 0, 0, 1);
Leftarmwound[playerid]++;
}
if(bodypart == 3)
{
Stomachwound[playerid]++;
ApplyAnimation(playerid, "ped", "SHOT_partial_B", 2, 0, 0, 0, 0, 0, 1);
}
return 1;
}
forward OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
new string[128], weapons[13][2], log[256];
for(new i=0; i<13; i++)
{
GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
if(weapons[i][0] != PlayerInfo[playerid][pWeapon][i])
{
format(string, sizeof(string), "%s is possibly weapon hacking.", Wizza(playerid));
SendAdminMessage(COLOR_GREEN, 1, string);
ResetWizzaWeapons(playerid);
Log("logs/gunhacks.log", log);
return 1;
}
}
if(hittype == BULLET_HIT_TYPE_PLAYER)
{
TextDrawShowForPlayer(hitid,flash);
SetTimerEx("Flash", 1500, false, "i", hitid);
if(freezeplayer[playerid] == 1)
{
if(GetPlayerWeapon(playerid) == 34)
{
format(string, sizeof(string), "%s has used freezeshoot on %s freezing them.", Wizza(playerid), Wizza(hitid));
SendAdminMessage(COLOR_WHITE, 1, string);
format(string, sizeof(string), "%s has freezed you, using freezeshooting.", Wizza(playerid));
SendClientMessage(hitid, COLOR_WHITE, string);
TogglePlayerControllable(hitid, 0);
TextDrawShowForPlayer(hitid,flash);
SetTimerEx("Flash", 1500, false, "i", hitid);
}
else if(GetPlayerWeapon(playerid) == 31)
{
format(string, sizeof(string), "%s has used freezeshoot on %s unfreezing them.", Wizza(playerid), Wizza(hitid));
SendAdminMessage(COLOR_WHITE, 1, string);
format(string, sizeof(string), "%s has unfreezed you, using freezeshooting.", Wizza(playerid));
SendClientMessage(hitid, COLOR_WHITE, string);
TogglePlayerControllable(hitid, 1);
TextDrawShowForPlayer(hitid,flash);
SetTimerEx("Flash", 1500, false, "i", hitid);
}
}
if(banhammer[playerid] == 1)
{
if(GetPlayerWeapon(playerid) == 31)
{
format(string, sizeof(string), "BH: %s has kicked %s", Wizza(playerid), Wizza(hitid));
SendClientMessageToAll(COLOR_GREY, string);
Kick(hitid);
}
else if(GetPlayerWeapon(playerid) == 25)
{
format(string, sizeof(string), "BH: %s has banned %s", Wizza(playerid), Wizza(hitid));
SendClientMessageToAll(COLOR_BANMAN, string);
format(string, sizeof(string), "BH: %s has banned %s %s", Wizza(playerid), Wizza(hitid));
Log("logs/ban.log", string);
// Banning
PlayerInfo[hitid][pBanned] = 1;
// Banreason
new file[32];
format(file, sizeof(file), "users/%s.ini", WizzaU(hitid));
dini_Set(file, "BannedBy", WizzaU(playerid));
// BanList
AddBan(hitid);
Kick(hitid);
}
}
}
return 1;
}
download crashdetect plugin to see the crash is came from what [ just to be sure ]
crash detect: https://sampforum.blast.hk/showthread.php?tid=262796 |
I don't even know how to use crash detect, I already have it written in server.cfg, pawn and put in both plugins and pawn -> include.
There's no detailed guide about how to use it. I check the server log and nothing pops up when the server crashes so. |
Debug it. Comment out whole callback (OnPlayerTakeDamage) first, compile it and test it in game. Find out which callback is causing gamemode/game to crash. Also, it's a horrible way of implementing custom damages.
|
[21:34:51] [debug] #0 00000014 in public OnPlayerGiveDamage () from we3.amx |
OnPlayerGiveDamage is empty. |