OnPlayerTakeDamage -
CriticalRP - 06.12.2013
It looks like OnPlayerTakeDamage is failing to work or return any value.
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID)
{
format(gString, sizeof(gString), "{aa0000}- %d HP", amount);
PlayerDamage[playerid] = Create3DTextLabel(gString, 0xFFFFFFFF, 0.0, 0.0, 0.0, 7.5, -1);
Attach3DTextLabelToPlayer(PlayerDamage[playerid], playerid, 0.0, 0.0, 0.4);
SetTimerEx("RemoveDamageLabel", 3000, false, "d", playerid);
}
return 1;
}
Re: OnPlayerTakeDamage -
McBan - 06.12.2013
Looks like another system is conflicting with it.
Re: OnPlayerTakeDamage -
CriticalRP - 06.12.2013
Is any of these includes has something to do with it?
Код:
#include <a_samp>
#include <a_mysql>
#include <sscanf2>
#include <zcmd>
#include <SPC>
#include <streamer>
#include <strlib>
#include <regex>
#include <foreach>
#include <fixes>
#include <timerfix>
Re: OnPlayerTakeDamage -
xVIP3Rx - 06.12.2013
Health is a float not an integer...
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID)
{
format(gString, sizeof(gString), "{aa0000}- %f HP", amount); //Hp is a float..
PlayerDamage[playerid] = Create3DTextLabel(gString, 0xFFFFFFFF, 0.0, 0.0, 0.0, 7.5, -1);
Attach3DTextLabelToPlayer(PlayerDamage[playerid], playerid, 0.0, 0.0, 0.4);
SetTimerEx("RemoveDamageLabel", 3000, false, "d", playerid);
}
return 1;
}
Re: OnPlayerTakeDamage -
CriticalRP - 06.12.2013
This is not my problem here, I have also tried printing whenever a player is taking damage, still doesnt work.
Re: OnPlayerTakeDamage -
Konstantinos - 06.12.2013
Quote:
Originally Posted by CriticalRP
This is not my problem here, I have also tried printing whenever a player is taking damage, still doesnt work.
|
Whenever a player is taking damage by another player or self-inflicted?
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
print("OnPlayerTakeDamage is being called..");
return 1;
}
Re: OnPlayerTakeDamage -
CriticalRP - 06.12.2013
Tried them both, both don't work.
Re: OnPlayerTakeDamage -
Pottus - 06.12.2013
This code wouldn't work anyways, it will create 3dtext with lost reference the timer should be set using the 3dtext ID not the playerid.
Re: OnPlayerTakeDamage -
RajatPawar - 06.12.2013
Quote:
Originally Posted by [uL]Pottus
This code wouldn't work anyways, it will create 3dtext with lost reference the timer should be set using the 3dtext ID not the playerid.
|
Should - he uses a MAX_PLAYER array so the playerID parameter is enough to destroy or modify it!
OT: You should try a print through OnPlayerGiveDamage too, and try de-including some files as said above! Check if a hook to this callback exists somewhere.
Re: OnPlayerTakeDamage -
Pottus - 06.12.2013
Quote:
Originally Posted by Rajat_Pawar
Should - he uses a MAX_PLAYER array so the playerID parameter is enough to destroy or modify it!
OT: You should try a print through OnPlayerGiveDamage too, and try de-including some files as said above! Check if a hook to this callback exists somewhere.
|
What happens when a player is shot twice think about it, the 3dtext id reference would be lost and you'd start getting 3dtext labels that wouldn't be deleted read the code.
Re: OnPlayerTakeDamage -
CriticalRP - 06.12.2013
Everything's sorted out but that includes thing, I couldn't find any conflict or something that coalesces with OnPlayerTakeDamage.
Re: OnPlayerTakeDamage -
Riddick94 - 06.12.2013
Quote:
pawn Код:
Delete3DTextLabel(PlayerDamage[playerid]); PlayerDamage[playerid] = Create3DTextLabel(gString, 0xFFFFFFFF, 0.0, 0.0, 0.0, 7.5, -1); Attach3DTextLabelToPlayer(PlayerDamage[playerid], playerid, 0.0, 0.0, 0.4); SetTimerEx("RemoveDamageLabel", 3000, false, "d", PlayerDamage[playerid]);
|
Can you imagine these timers called everytime when callback is called? Also, my suggestion is to kill timer before it's called.
Re: OnPlayerTakeDamage -
CriticalRP - 06.12.2013
Optimization is not the actual problem here, I just want the public to be called.
Re: OnPlayerTakeDamage -
yanir3 - 06.12.2013
Yes you need to insert
Fix() in the function
OK
Re: OnPlayerTakeDamage -
Richie© - 06.12.2013
Why not just use
SetPlayerChatBubble ?
Re: OnPlayerTakeDamage -
CriticalRP - 06.12.2013
This is not my problem here, the problem is that the callback in not being called.
Re: OnPlayerTakeDamage -
Pottus - 06.12.2013
Quote:
Originally Posted by Richie©
|
That is probably a very very good way to do it.
Re: OnPlayerTakeDamage -
CriticalRP - 08.12.2013
I can't even use SendClientMessage as the callback is not being called.
Anyone?
Re: OnPlayerTakeDamage -
CriticalRP - 11.12.2013
Bump.