OnPlayerWeaponShot is never called? HELP PLS
#1

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=*********
Reply
#2

OnPlayerWeaponShot is never called if lag compensation is turned off. So you might want to check that first.
Reply
#3

Yeah, i got it enabled in the server.cfg. It's very strange.. help please..
Reply
#4

Includes with bad hooks can prevent it from getting called, so you should check those too.
Reply
#5

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?
Reply
#6

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.
Reply
#7

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)