Animated Rotation?
#15

Quote:
Originally Posted by yugokoral
...
pawn Код:
#include <a_samp>

forward CheckGate();
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);

new OpenGate[MAX_PLAYERS];

new zapornice;

public OnGameModeInit()
{
  zapornice = CreateObject(968, -1572.203613, 658.795593, 6.918911, 0.000000, 90.000000, 90.000000);
  SetTimer("CheckGate", 10, 1);
   return 1;
}

public CheckGate()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
      if(PlayerToPoint(10.0, i, -1572.1993,663.0866,7.1875) && OpenGate[i] == 0)
      {
        new Float:rotx, Float:roty, Float:rotz;
        GetObjectRot(zapornice, rotx, roty, rotz);
        if(roty != 0.0) SetObjectRot(zapornice, rotx, roty-0.1, rotz);
        else OpenGate[i] = 1;
      }
      else if(!PlayerToPoint(10.0, i, -1572.1993,663.0866,7.1875) && OpenGate[i] == 1)
      {
        new Float:rotx, Float:roty, Float:rotz;
        GetObjectRot(zapornice, rotx, roty, rotz);
        if(roty != 90.0) SetObjectRot(zapornice, rotx, roty+0.1, rotz);
        else OpenGate[i] = 0;
      }
    }
  }
  return 1;
}

public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
  new Float:oldposx, Float:oldposy, Float:oldposz;
  new Float:tempposx, Float:tempposy, Float:tempposz;
  GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  tempposx = (oldposx -x);
  tempposy = (oldposy -y);
  tempposz = (oldposz -z);
  if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  {
    return 1;
  }
  return 0;
}
You set the timer 2 times, try this.
Reply


Messages In This Thread
Animated Rotation? - by Flibber100 - 09.05.2008, 14:16
Re: Animated Rotation? - by Snickers - 09.05.2008, 14:18
Re: Animated Rotation? - by Giacomand - 09.05.2008, 14:24
Re: Animated Rotation? - by Carlos_Leone - 09.05.2008, 14:55
Re: Animated Rotation? - by Snickers - 09.05.2008, 14:55
Re: Animated Rotation? - by Flibber100 - 09.05.2008, 15:52
Re: Animated Rotation? - by Giacomand - 09.05.2008, 16:09
Re: Animated Rotation? - by mini_tomo_2 - 09.05.2008, 16:13
Re: Animated Rotation? - by Yaheli_Faro - 09.05.2008, 16:15
Re: Animated Rotation? - by yugokoral - 29.10.2008, 12:53
Re: Animated Rotation? - by Finn - 29.10.2008, 13:19
Re: Animated Rotation? - by yugokoral - 29.10.2008, 13:43
Re: Animated Rotation? - by Finn - 29.10.2008, 14:16
Re: Animated Rotation? - by yugokoral - 29.10.2008, 15:41
Re: Animated Rotation? - by Finn - 29.10.2008, 15:51
Re: Animated Rotation? - by yugokoral - 29.10.2008, 16:29
Re: Animated Rotation? - by Finn - 29.10.2008, 16:44
Re: Animated Rotation? - by yugokoral - 29.10.2008, 17:11
Re: Animated Rotation? - by Finn - 29.10.2008, 17:20
Re: Animated Rotation? - by yugokoral - 29.10.2008, 17:27
Re: Animated Rotation? - by yugokoral - 29.10.2008, 17:32
Re: Animated Rotation? - by LTomi - 26.02.2009, 15:52
Re: Animated Rotation? - by LTomi - 27.02.2009, 12:53

Forum Jump:


Users browsing this thread: 1 Guest(s)