Object movement
#1

This code works, but moves my object not regularly. How to fix that?


Код:
#include <a_samp>
#define COLOR_LIGHTBLUE 0x33CCFFAA

new Scud;
new SkudSmoke;
new ProgressTimer;
new Float:x,Float:y,Float:z;

forward Misile(playerid);
forward ScudLaunch(playerid);
forward ScudProgres(playerid);


public OnFilterScriptInit()
{
SetTimer("Misile",30000,0);

return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}


public Misile(playerid)
{
Scud=CreateObject(17050,-1648.990,281.410,6.170,0.0,0.0,-339.434);
SkudSmoke=CreateObject(2780,-1649.058,281.403,5.425,0.0,0.0,0.0);
SetTimer("ScudLaunch",10000,0);
return 0;
}


public ScudLaunch(playerid)
{
MoveObject(Scud,-1648.990,281.410,170.000,15);
DestroyObject(SkudSmoke);
ProgressTimer=SetTimer("ScudProgres",200,1);
}


public ScudProgres(playerid)
{
GetObjectPos(Scud,x,y,z);
CreateExplosion(x,y,z,3,3);
{
if(z>=160.000)
{
KillTimer(ProgressTimer);
DestroyObject(Scud);
SetTimer("Misile",30000,0);
}
return 0;
}
}
Reply
#2

pawn Код:
SetTimer("Misile",30000,0);
try a shorter time 30,000 = 30 seconds
Reply
#3

change time interval is not a solution, i tried. The problem is somewhere else.
Reply
#4

Try this:

Код:
#include <a_samp>

#define COLOR_LIGHTBLUE 0x33CCFFAA

new Scud;
new SkudSmoke;
new ProgressTimer;
new Float:x,Float:y,Float:z;

forward Misile(playerid);
forward ScudLaunch(playerid);
forward ScudProgres(playerid);


public OnFilterScriptInit()
{
  SetTimer("Misile",30000,0);
  return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}


public Misile(playerid)
{
   Scud=CreateObject(17050,-1648.990,281.410,6.170,0.0,0.0,-339.434);
   SkudSmoke=CreateObject(2780,-1649.058,281.403,5.425,0.0,0.0,0.0);
   SetTimer("ScudLaunch",10000,0);
   return 0;
}


public ScudLaunch(playerid)
{
   MoveObject(Scud,-1648.990,281.410,170.000,15);
   DestroyObject(SkudSmoke);
   ProgressTimer=SetTimer("ScudProgres",200,1);
}


public ScudProgres(playerid)
{
   GetObjectPos(Scud,x,y,z);
   CreateExplosion(x,y,z,3,3);
   {
   if(z>=160.000)
   {
   KillTimer(ProgressTimer);
   DestroyObject(Scud);
   SetTimer("Misile",30000,0);
   }
   return 0;
  }
}
Reply
#5

This is exactly the same code. This funcion shuld be looping, so this object shuld be created and destroyed with same time intervals. However sometimes this cycle tooks about 50 seconds, which is normal and sometimes about 2 minutes. So i want to ask why this funcion cycle is not a constant?
Reply
#6

Quote:
Originally Posted by Liustas
This is exactly the same code. This funcion shuld be looping, so this object shuld be created and destroyed with same time intervals. However sometimes this cycle tooks about 50 seconds, which is normal and sometimes about 2 minutes. So i want to ask why this funcion cycle is not a constant?
I changed it a bit just try it , replace with the old code.
Reply
#7

Still the same problem, works for the first few times then starts late.
Reply
#8

Any suggestions ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)