27.11.2010, 14:29
so im using getxyinfrontofplayer to create a object infront of player and i want when the player passes the object, it gets destroyed?
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));
}
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]);
}
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;
}