OnPlayerDeath isn't getting called correctly
#1

Right, i'm in the process of making a minigame for my server, which is using OnPlayerDeath.

I've debugged it and found that only "1" & "5" are getting called on the server console.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new string[128];
    SendDeathMessage(killerid, playerid, reason);
    print("1");
    if(isInLaserShoot{playerid} == true && IsPlayerInAnyVehicle(playerid)) {
        print("2");
        if(killerid != INVALID_PLAYER_ID) {
            print("3");
            format(string, sizeof string, "[LASER] You was exploded by, %s!", GetName(killerid));
            SendClientMessage(playerid, COLOR_WHITE, string);
            pLaserPoints{killerid} += 1;
            format(string, sizeof string, "~g~Winning: ~w~%s ( ~b~%dpts ~w~)", GetName(killerid), pLaserPoints{killerid});
            TextDrawSetString(Winning, string);
            PlayerInfo[killerid][pKills]++;
        }
        print("4");
        format(string, sizeof string, "[LASER] You died unexpectedly!");
        SendClientMessage(playerid, COLOR_WHITE, string);
        lastVehID{playerid} = GetPlayerVehicleID(playerid);
        pLaserPoints{playerid} -= 1;
        format(string, sizeof string, "~r~Losing: ~w~%s ( ~b~%dpts ~w~)", GetName(playerid), pLaserPoints{playerid});
        TextDrawSetString(Losing, string);
    }
    print("5");
    PlayerInfo[playerid][pDeaths]++;
    return 1;
}
I've tried everything to fix it, but nothing is working, so I've resorted here.
Reply
#2

Line 6:
Код:
if(isInLaserShoot{playerid} == true && IsPlayerInAnyVehicle(playerid)) {
Please try changing this to:
Код:
if(isInLaserShoot(playerid) == true && IsPlayerInAnyVehicle(playerid)) {
Did the compiler not pick up on that?
Other than that, have you thoroughly tested the isInLaserShoot function?
Reply
#3

The reason it's "{playerid}" is cause i'm using char arrays.
Reply
#4

"Cut" the isInLaserShoot and IsPlayerInAnyVehicle checks;
pawn Код:
if(isInLaserShoot{playerid} == true) {
    print("2");
    if(IsPlayerInAnyVehicle(playerid)) {
        print("3");
..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)