OnPlayerTakeDamage & OnPlayerGiveDamage not being called. -
Kyance - 31.12.2014
After I switched to MySQL( i think ), OnPlayerTakeDamage & OnPlayerGiveDamage stopped working.
I tried debugging to see what's going on, but
NOTHING is being called!
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
print("onplayertakedamage start");
if(issuerid != INVALID_PLAYER_ID)
{
print("not invalid issuerid");
if(SpawnMode[ issuerid ] == SPAWNMODE_SNIPERDM || SpawnMode[ issuerid ] == SPAWNMODE_FREEFORALL)
{
if(weaponid == WEAPON_SNIPER && bodypart == 9)
{
GameTextForPlayer(playerid, "~r~~n~~n~~n~~n~~n~HEADSHOT", 1500, 3);
SendClientMessage(issuerid, COLOR_RADIO, "Player shot in the head - Instant kill!");
SetPlayerHealth(playerid, 0);
}
}
if(!GodMode{ playerid })
{
PlayerPlaySound(issuerid, 17802, 0, 0, 0);
}
else
{
GameTextForPlayer(issuerid, "~g~TARGET HAS GODMODE", 3000, 3);
}
if(AdminDuty{ playerid })
{
GameTextForPlayer(issuerid, "~r~~h~DON'T ATTACK ON-DUTY ADMINS", 3000, 3);
}
}
print("onplayertakedamage end");
return 1;
}
Any ideas what's wrong? ;_;
Re: OnPlayerTakeDamage & OnPlayerGiveDamage not being called. -
Ryz - 31.12.2014
this also happened with me 1 week ago when i defined Y_INI in my gamemode. and found that my ysi is out dated so,
Make sure youre using all latest includes
Re: OnPlayerTakeDamage & OnPlayerGiveDamage not being called. -
Lordzy - 31.12.2014
Are you using any includes that uses one of these callbacks? Simply changing to MySQL shouldn't be the reason behind it.
Re: OnPlayerTakeDamage & OnPlayerGiveDamage not being called. -
Kyance - 31.12.2014
Quote:
Originally Posted by Lordzy
Are you using any includes that uses one of these callbacks? Simply changing to MySQL shouldn't be the reason behind it.
|
Only "callbacks" (
https://sampforum.blast.hk/showthread.php?tid=490436 ) uses "OnPlayerTakeDamage".
Removed "callbacks" and all of the sudden it works :l
edit: I re-downloaded it, added it & compiled, and it didn't work.
So the problem is the "callbacks" include.
Re: OnPlayerTakeDamage & OnPlayerGiveDamage not being called. -
Lordzy - 31.12.2014
I viewed that include, the problem is because it's not hooked. Emmet would have probably forgotten to because he codes mostly at late nights.
FIX:
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
if (g_bCallbacks & CB_OnPlayerBurning && weaponid == 37)
{
if (!(g_cbPlayers[playerid][e_cbFlags] & e_cbBurning))
{
g_cbPlayers[playerid][e_cbFlags] |= e_cbBurning;
CallLocalFunction("OnPlayerBurning", "dd", playerid, 1);
}
g_cbPlayers[playerid][e_cbLastBurn] = GetTickCount();
}
#if defined CB_OnPlayerTakeDamage
return CB_OnPlayerTakeDamage(playerid, issuerid, amount, weaponid, bodypart);
#else
return 1;
#endif
}
Re: OnPlayerTakeDamage & OnPlayerGiveDamage not being called. -
Kyance - 31.12.2014
Quote:
Originally Posted by Lordzy
I viewed that include, the problem is because it's not hooked. Emmet would have probably forgotten to because he codes mostly at late nights.
FIX:
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart) { if (g_bCallbacks & CB_OnPlayerBurning && weaponid == 37) { if (!(g_cbPlayers[playerid][e_cbFlags] & e_cbBurning)) { g_cbPlayers[playerid][e_cbFlags] |= e_cbBurning; CallLocalFunction("OnPlayerBurning", "dd", playerid, 1); } g_cbPlayers[playerid][e_cbLastBurn] = GetTickCount(); } #if defined CB_OnPlayerTakeDamage return CB_OnPlayerTakeDamage(playerid, issuerid, amount, weaponid, bodypart); #else return 1; #endif }
|
Thanks!
off-topic: didn't he quit samp? o.o