Object question - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Object question (
/showthread.php?tid=238528)
Object question -
Tommy_Mandaz - 11.03.2011
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);
}
}
Re: Object question -
JaTochNietDan - 12.03.2011
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
Re: Object question -
Tommy_Mandaz - 12.03.2011
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
Re: Object question -
Tommy_Mandaz - 12.03.2011
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!
Re: Object question -
Tommy_Mandaz - 12.03.2011
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!
Re: Object question -
admantis - 12.03.2011
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
Re: Object question -
Tommy_Mandaz - 12.03.2011
Thank you very much atleast you lead me to the right direction admantis
. thanks again dude.