OnPlayerWeaponShot is never called? HELP PLS -
DerxonTM - 11.09.2016
Hello everyone. It's not common for me to ask for help on this forum but today i will do it because i am tired about this..
I made a object system, so the weappon when has 0 ammo should stay on the hand as attached object bla bla bla..
The problem is that i made that for check is a user is using ammo, put -1 ammo in OnPlayerWeaponShot, but it seems that the player shot but the ammo variable never lose value. I added to OnPlayerWeaponShot a SendClientMessage for check if it is being called but it's seems that it never send those messages.
Here you can see my OnPlayerWeaponShot:
Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(EsArma(pInfo[playerid][ManoDer])) { pInfo[playerid][ManoDerCantidad]--;} //This reduce the ammo -1
new string[256]; format(string, sizeof(string), "Testeo: Disparas una bala, te quedan: %d. (Temporal)", pInfo[playerid][ManoDerCantidad]);
SendClientMessage(playerid, Gris, string); //The message was never sent, so, wtf?
return 1;
}
CMD:checkammo(playerid, params[])
{
if(EsArma(pInfo[playerid][ManoDer]))
{
new string[256]; format(string, sizeof(string), "You have a weappon at the right hand; Ammo: %d", pInfo[playerid][ManoDerCantidad]);
SendClientMessage(playerid, Gris, string);
}
return 1;
}
And here you will see a video for understant better what is happening..
https://www.youtube.com/watch?v=5ROK...ature=*********
Re: OnPlayerWeaponShot is never called? HELP PLS -
Vince - 11.09.2016
OnPlayerWeaponShot is never called if lag compensation is turned off. So you might want to check that first.
Respuesta: OnPlayerWeaponShot is never called? HELP PLS -
DerxonTM - 11.09.2016
Yeah, i got it enabled in the server.cfg. It's very strange.. help please..
Re: OnPlayerWeaponShot is never called? HELP PLS -
PrO.GameR - 11.09.2016
Includes with bad hooks can prevent it from getting called, so you should check those too.
Respuesta: OnPlayerWeaponShot is never called? HELP PLS -
DerxonTM - 11.09.2016
It stopped working after some updates on the object system. It's strange i don't think it's going to be bad hooks. Thank you bro for the help too.
EDIT 2: I discovered that the bullets register if i shot in the normal SA map but if i shot them in a own mapped interior they don't register, any idea about how to fix this?
Re: Respuesta: OnPlayerWeaponShot is never called? HELP PLS -
GoldenLion - 11.09.2016
Quote:
Originally Posted by DerxonTM
It stopped working after some updates on the object system. It's strange i don't think it's going to be bad hooks. Thank you bro for the help too.
EDIT 2: I discovered that the bullets register if i shot in the normal SA map but if i shot them in a own mapped interior they don't register, any idea about how to fix this?
|
That's probably because you are shooting a dynamic object. Streamer has a callback called OnPlayerShootDynamicObject for that.
Respuesta: Re: Respuesta: OnPlayerWeaponShot is never called? HELP PLS -
DerxonTM - 11.09.2016
Quote:
Originally Posted by GoldenLion
That's probably because you are shooting a dynamic object. Streamer has a callback called OnPlayerShootDynamicObject for that.
|
This was. For who neeed to fix it, use this please:
Код:
public OnPlayerShootDynamicObject(playerid, weaponid, objectid, Float:x, Float:y, Float:z)
{
return 1;
}
Thanks to all! Especially to you GoldenLion, i found it one hour ago but it's fine broh!