SA-MP Forums Archive
[help]on object moved - 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: [help]on object moved (/showthread.php?tid=127631)



[help]on object moved - braduz - 14.02.2010

Im working on an airstrike, comming along amazingly
public OnObjectMoved()
{
new Float, Float:y, Float:z;
GetObjectPos(missile, x, y, z);
DestroyObject(missile);
CreateExplosion(x, y, z, 12, 10.0);
return 1;
}
thats the thorn in the bush
I cant find a way (cant describe)
like this-
if object = missile
then (all that stuff from above)



Re: [help]on object moved - mansonh - 14.02.2010

Well if your using a particular object for a missile then just compare its object type id.

Other than that have an array of missile objects and then see if its in that list.


Re: [help]on object moved - braduz - 14.02.2010

Quote:
Originally Posted by mansonh
Well if your using a particular object for a missile then just compare its object type id.

Other than that have an array of missile objects and then see if its in that list.
Yeh but how


Re: [help]on object moved - mansonh - 14.02.2010

Good point, I don't know any function that returns an objects type.

If you using an object streamer, just add a variable to include either object type or that its a missile or not.

If your not using a streamer then just create an array for objects types or if missile.

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

ex.
new objectstypes[254];

then when you create an object set objectstype[id] = objectype;


Re: [help]on object moved - braduz - 14.02.2010

still confused
not used that before


Re: [help]on object moved - mansonh - 14.02.2010

You need to flag somewhere that your object is a missile or not.
So have an array for all objects identifying if its a missile or not.

new objectismissile[254];

then whenever you create a missile
new objectid = CreateObject(...); //unless your using a streamer
put
objectismissile[objectid]=1;//means it is a missile

Then in your function check
public OnObjectMoved(objectid)
{
if(objectismissile[objectid])
{
new Float, Float:y, Float:z;
GetObjectPos(missile, x, y, z);
DestroyObject(missile);
CreateExplosion(x, y, z, 12, 10.0);
}
return 1;
}


Re: [help]on object moved - braduz - 14.02.2010

Quote:
Originally Posted by mansonh
You need to flag somewhere that your object is a missile or not.
So have an array for all objects identifying if its a missile or not.

new objectismissile[254];

then whenever you create a missile
new objectid = CreateObject(...); //unless your using a streamer
put
objectismissile[objectid]=1;//means it is a missile

Then in your function check
public OnObjectMoved(objectid)
{
if(objectismissile[objectid])
{
new Float, Float:y, Float:z;
GetObjectPos(missile, x, y, z);
DestroyObject(missile);
CreateExplosion(x, y, z, 12, 10.0);
}
return 1;
}
wtf
C:\Users\Braduz\Desktop\Server\gamemodes\tAxIFRB.p wn(4583) : error 017: undefined symbol "objectid"
error 076: syntax error in the expression, or invalid function call
C:\Users\Braduz\Desktop\Server\gamemodes\tAxIFRB.p wn(5581) : error 076: syntax error in the expression, or invalid function call


Re: [help]on object moved - mansonh - 15.02.2010

Your errors are from two different places, post the code where those errors come from.

I assume you modified that code to fit with yours.


Re: [help]on object moved - braduz - 15.02.2010

Nvm F that
decided to delete the script


Re: [help]on object moved - mansonh - 15.02.2010

don't give up its not that hard. just try again.