detect if a object is behind of you? -
The_Gangstas - 27.11.2010
so im using getxyinfrontofplayer to create a object infront of player and i want when the player passes the object, it gets destroyed?
Re: detect if a object is behind of you? -
boelie - 27.11.2010
maybe this helps;
Код:
GetXYBehindPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
new Float:a;
GetPlayerPos(playerid, x, y, a);
GetPlayerFacingAngle(playerid, a);
if (GetPlayerVehicleID(playerid))
{
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
}
a +=180;
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
}
Re: detect if a object is behind of you? -
The_Gangstas - 27.11.2010
ye i cant figure it out..
im trying to create 4 pickups infront of me, each 2+ infront then after i pass each one delete it and add a new one infront
pawn Код:
GetXYInFrontOfPlayer(playerid, x2, y2, 3);
for(new i = 0; i < sizeof(GpsPickups); i++)
{
GpsPickups[i] =
CreateDynamicObject(1318, x2, y2, z2, 0, 0, 0, -1,-1,-1,200.0);
GetXYInBehindPlayer(playerid,x2,y2,4);
DestroyDynamicObject(GpsPickups[i]);
}
Re: detect if a object is behind of you? -
boelie - 27.11.2010
i made this command you could try out you can replace the object as createpickup
Код:
if(strcmp(cmdtext, "/objects", true) == 0)
{
new Float:xnob,Float:ynob,Float:znob;
GetPlayerPos(playerid,xnob,ynob,znob);
GetXYInFrontOfPlayer(playerid,xnob,ynob,0.5);
CreateObject(1375,xnob,ynob,znob,0,0,0,1.0);
GetXYBehindPlayer(playerid,xnob,ynob,0.5);
CreateObject(1375,xnob,ynob,znob,0,0,0,1.0);
return 1;
}
obviously it creates objects in front and behind you
Re: detect if a object is behind of you? -
The_Gangstas - 27.11.2010
i know but i need to create 4-5 pickups infront each 1+ meter infront of each other then when the player passes them or goes somewhere else it destroys those and makes new ones infront
Re: detect if a object is behind of you? -
boelie - 27.11.2010
cant you use gexyinfront twice then? just with different distances ?
Re: detect if a object is behind of you? -
The_Gangstas - 27.11.2010
yes, but behind is my problem i dont know how to use it to destroy the object