OnPlayerDeath isn't getting called correctly - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerDeath isn't getting called correctly (
/showthread.php?tid=547943)
OnPlayerDeath isn't getting called correctly -
Luis- - 26.11.2014
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.
Re: OnPlayerDeath isn't getting called correctly -
Simeon87 - 26.11.2014
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?
Re: OnPlayerDeath isn't getting called correctly -
Luis- - 26.11.2014
The reason it's "{playerid}" is cause i'm using char arrays.
Re: OnPlayerDeath isn't getting called correctly -
Kyance - 26.11.2014
"Cut" the isInLaserShoot and IsPlayerInAnyVehicle checks;
pawn Код:
if(isInLaserShoot{playerid} == true) {
print("2");
if(IsPlayerInAnyVehicle(playerid)) {
print("3");
..