Use this:
x0,y0 - start position t - time (1,2,3,4,5..., you can use Float for better results) alpha - angle for shoot v0 - speed of shoot g - gravitation (9.806) x,y - current position for object in time t cyklus for t (time) + caltulate position in time (more times it's better look, but many calculates). I had used for golf engine on my server and works fine. |
stock MoveFire(Float:x, Float:y, Float:z, Float:angle)
{
new Float: tx;
new Float: ty;
new time = 3;
tx = x + 100*time*floatcos(angle);
ty = y + 100*time*floatsin(angle)-1/2*9.806*time*time;
new DynamicObject = CreateDynamicObject(2064, x, y, z, 0.00000, 0.00000, 0.00000);
MoveDynamicObject(DynamicObject, tx, ty, z, 3.0);
return 1;
}
CMD:test(playerid, params[])
{
new Float:x,Float:y,Float:z;
new Float:angle;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angle);
MoveFire(x, y, z, angle);
return 1;
}
PHP код:
|
new closeddoor13; //under ongamemodeinit closeddoor13=CreateObject(2930, 2571.82983, -1532.14771, -47.34000, 0.00000, 0.00000, 90.00000); // execute with OpenDoor13(playerid, 5000); stock OpenDoor13(playerid, time) { new str[128]; MoveObject(closeddoor13, 2573.22778, -1532.11182, -47.34000, 2.0); format(str,sizeof(str),"%s(%i) inserts an code and presses the confirm button.",PlayerName(playerid),playerid); SetTimerEx("CloseDoor13", time, false, "i", playerid); SendNearbyMessage(playerid,30.0,str,ORANGE); } forward CloseDoor13(playerid); public CloseDoor13(playerid) { MoveObject(closeddoor13, 2571.82983, -1532.14771, -47.34000, 2.0); }