Object question
#1

Hello,

I am trying to make a small fire script. I created the objects and I want it so that if the person is aiming at the fire with a fire extinguisher the object deletes. I am using fire objects instead of a normal fire because I want it to stay there and sync.

This is what I am trying but its very wrong, please help:

Код:
public OnPlayerUpdate(playerid)
{
If(GetPlayerCameraPos(playerid, firex, firey, firez) && weaponid == 42)
{
DeleteObject(18691);
DeleteObject(18692);
DeleteObject(18691);
DeleteObject(18692);
DeleteObject(18691);
DeleteObject(18692);
}
}
Reply
#2

Are you sure you're using the right object ID's of the object instances you want to destroy and not the object model? It's a common mistake people make, you don't refer to the model of the object instance when interacting with it through Pawn functions, you refer to the unique object ID.

See this page for more information:

https://sampwiki.blast.hk/wiki/DestroyObject

You can also take a look at this page for an example on storing the object ID and refering to it in later code:

https://sampwiki.blast.hk/wiki/MoveObject
Reply
#3

Yeah but thats not what I mean, the problem is I cant make it so that when the person is looking at the fire while holding a fire extinguisher and sprays the fire extinguisher to put out the fire I want it to delete the fire objects. Thanks
Reply
#4

Bump - Common guys please help me out here, I really only posted this thread because I dont know what to do please someone more experienced help me out, thanks!
Reply
#5

Bump - Someone help thanks please I really wanna work on this. I just wanna know how can I make it know if the person is looking at the object or not with a fire extinguisher thanks!
Reply
#6

You sir need to remove that snippet. Now look for OnPlayerKeyStateChange and check if the aim button is HOLDED (there is a macro to check holded keys, but I can't provide). GetCameraPos won't do anything, you need some maths and use the following function: GetPlayerCameraFrontVector. It's not really easy as you thought.

https://sampwiki.blast.hk/wiki/GetPlayerCameraFrontVector
https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
Reply
#7

Thank you very much atleast you lead me to the right direction admantis . thanks again dude.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)