A player hits another player with fists and server crash
#1

Basically when a player in my server hits another player, the server crashes idk why.


These are the only callbacks that could have caused this that I could find

I don't see a problem myself so I'm asking for you guys to help me

OnPlayerGiveDamage is empty.


pawn Код:
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;
}
pawn Код:
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;
}
Reply
#2

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
Reply
#3

Quote:
Originally Posted by jlalt
Посмотреть сообщение
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.
Reply
#4

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.
Reply
#5

Quote:
Originally Posted by Write
Посмотреть сообщение
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.
if you're using crash detect & it load perfectly and nothing print in server log after it goes offline then the problem is not server crash instead it server being offline I mean server shutting down due to other reasons

note: you don't need to do anything with crashdetect just put it as plugin and it will do its job perfectly xd
Reply
#6

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
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.
So give me a better way.

Here's the backtrace from the crash btw.

[21:34:51] [debug] Server crashed while executing we3.amx
[debug] AMX backtrace:
[21:34:51] [debug] #0 00000014 in public OnPlayerGiveDamage () from we3.amx
[21:34:52] [debug] Native backtrace:
[21:34:52] [debug] #0 73987ee2 in ?? () from plugins\crashdetect.DLL
[21:34:52] [debug] #1 739809c7 in ?? () from plugins\crashdetect.DLL
[21:34:52] [debug] #2 7398631a in ?? () from plugins\crashdetect.DLL
[21:34:52] [debug] #3 6b0f51b9 in ?? () from plugins\streamer.DLL
[21:34:52] [debug] #4 0046ec8c in ?? () from samp-server.exe
[21:34:52] [debug] #5 004913e5 in ?? () from samp-server.exe
[21:34:52] [debug] #6 739801c7 in ?? () from plugins\crashdetect.DLL
[21:34:52] [debug] #7 004851ea in ?? () from samp-server.exe
[21:34:52] [debug] #8 0040174f in ?? () from samp-server.exe
Reply
#7

Quote:

[21:34:51] [debug] #0 00000014 in public OnPlayerGiveDamage () from we3.amx

Quote:

OnPlayerGiveDamage is empty.

try to full remove OnPlayerGiveDemage?
Reply
#8

Quote:
Originally Posted by jlalt
Посмотреть сообщение
try to full remove OnPlayerGiveDemage?
same crash different log
now it talks about onplayertakedamage

[21:49:16] [debug] AMX backtrace:
[21:49:16] [debug] #0 00000000 in public OnPlayerTakeDamage () from we3.amx
[21:49:17] [debug] Native backtrace:
[21:49:17] [debug] #0 73987ee2 in ?? () from plugins\crashdetect.DLL
[21:49:17] [debug] #1 739809c7 in ?? () from plugins\crashdetect.DLL
[21:49:17] [debug] #2 7398631a in ?? () from plugins\crashdetect.DLL
[21:49:17] [debug] #3 6b0f51b9 in ?? () from plugins\streamer.DLL
[21:49:17] [debug] #4 0046ec0c in ?? () from samp-server.exe
[21:49:17] [debug] #5 004913a3 in ?? () from samp-server.exe
[21:49:17] [debug] #6 739801c7 in ?? () from plugins\crashdetect.DLL
[21:49:17] [debug] #7 004851ea in ?? () from samp-server.exe
[21:49:17] [debug] #8 0040174f in ?? () from samp-server.exe
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)