[help]on object moved
#1

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)
Reply
#2

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

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

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;
Reply
#5

still confused
not used that before
Reply
#6

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;
}
Reply
#7

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

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

Nvm F that
decided to delete the script
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)