detect if a object is behind of you?
#1

so im using getxyinfrontofplayer to create a object infront of player and i want when the player passes the object, it gets destroyed?
Reply
#2

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

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

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

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

cant you use gexyinfront twice then? just with different distances ?
Reply
#7

yes, but behind is my problem i dont know how to use it to destroy the object
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)