Author Topic: Speedometer In gups help me :/  (Read 3899 times)

0 Members and 2 Guests are viewing this topic.

Offline Pawno

  • Street Thug
  • *
  • Posts: 15
    • View Profile
Speedometer In gups help me :/
« on: December 19, 2010, 07:33:10 am »
gups speedometer how to put in when I get in the car?


Offline Madara

  • Street Thug
  • *
  • Posts: 48
    • View Profile
Re: Speedometer In gups help me :/
« Reply #1 on: December 19, 2010, 08:26:02 am »
I remember had issue with the same question :-\

Offline Terminatorupgrade 2

  • Wiseguy
  • **
  • Posts: 91
  • pawno scripter
    • View Profile
Re: Speedometer In gups help me :/
« Reply #2 on: December 19, 2010, 10:32:29 am »
yes mee too :o

Offline [AoD]NC

  • VC:MP Beta Tester
  • VC:MP Veteran
  • *
  • Posts: 616
  • AoD forever!
    • View Profile
    • KURWA MAĆ
Re: Speedometer In gups help me :/
« Reply #3 on: December 19, 2010, 03:03:15 pm »
There were several topics about speedometers, use >SEARCH< !

Offline Terminatorupgrade 2

  • Wiseguy
  • **
  • Posts: 91
  • pawno scripter
    • View Profile
Re: Speedometer In gups help me :/
« Reply #4 on: December 19, 2010, 04:07:20 pm »
I searched But there was no Code :-[
how to make autodrown -killing in bank and spree?
+
« Last Edit: December 21, 2010, 05:13:52 pm by StriKe »

Offline MISHA123152

  • Street Thug
  • *
  • Posts: 46
    • View Profile
    • Russian Server
Re: Speedometer In gups help me :/
« Reply #5 on: December 25, 2010, 06:28:47 pm »
enum SavePlayerPosEnum
{
   Float:LastX,
   Float:LastY,
   Float:LastZ
}

new CheckGasTimer,
   StoppedVehicleTimer,
   BenzinUpdateTimer,
   Gas[CAR_AMOUNT],
   SavePlayerPos[50][SavePlayerPosEnum],
   asp = 0,
   PlayerInfo[MAX_PLAYERS][pInfo],
   ServerInfo[1][sInfo],
   file[128],
   wep_init = 0,
   gWeapons[MAX_WEAPONS][64],
   gPlayers[MAX_PLAYERS][MAX_PLAYER_NAME+1];

forward BenzinUpdate();
forward   Fillup();
forward   StoppedVehicle();
forward   CheckGas();

public BenzinUpdate()
{
   for(new i=0;i<=MAX_PLAYERS;i++){
       if(IsPlayerConnected(i)){
          if(GetPlayerState(i)==PLAYER_STATE_DRIVER){
             new vehicle=GetPlayerVehicleID(i);
            if(GetPlayerState(i)==PLAYER_STATE_DRIVER){
               if(Gas[vehicle]>=0&&Gas[vehicle]<=0)RemovePlayerFromVehicle(i);
               if(PlayerInfo[Spawned]==0)GameTextForPlayerBottom(i,"\x10");
               new string[256];if(Gas[vehicle]<6)format(string,sizeof(string),"~r~%d%",Gas[vehicle]);
               if(Gas[vehicle]>=6)format(string,sizeof(string),"%d%",Gas[vehicle]);
               GameTextForPlayerBottom(i,string);
            }
            }
         else if(PlayerInfo[Spawned]==1)GameTextForPlayerBottom(i,"\x10");
      }
   }
   return 1;
}
public CheckGas()
{
   for(new i=0;i<=MAX_PLAYERS;i++){
       if(IsPlayerConnected(i)){
              if(GetPlayerState(i)==PLAYER_STATE_DRIVER){
                new vehicle=GetPlayerVehicleID(i);
              if(Gas[vehicle]>=1)Gas[vehicle]--;
         }
       }
   }
   return 1;
}
public StoppedVehicle()
{
   new Float:x,Float:y,Float:z;
   for(new i=0;i<MAX_PLAYERS;i++){
      if(IsPlayerConnected(i)){
         if(GetPlayerState(i)==PLAYER_STATE_DRIVER){
            GetPlayerPos(i,x,y,z);
            new Float:distance,value;
            distance=floatsqroot(floatpower(floatabs(floatsub(x,SavePlayerPos[LastX])),2)+floatpower(floatabs(floatsub(y,SavePlayerPos[LastY])),2)+floatpower(floatabs(floatsub(z,SavePlayerPos[LastZ])),2));
            value=floatround(distance*3600);
            new VID=GetPlayerVehicleID(i);
            if(value==0)Gas[VID]++;
            SavePlayerPos[LastX]=x;
            SavePlayerPos[LastY]=y;
            SavePlayerPos[LastZ]=z;
         }
      }
   }
   return 1;
}

public OnPlayerConnect(playerid)
{
    BenzinUpdateTimer=SetTimer("BenzinUpdate",1000,1);
StoppedVehicleTimer=SetTimer("StoppedVehicle",120000,1);
CheckGasTimer=SetTimer("CheckGas",120000,1);
}
public OnPlayerDisconnect(playerid, reason)
{
    
   KillTimer(CheckGasTimer);
   KillTimer(StoppedVehicleTimer);
   KillTimer(BenzinUpdateTimer);
}
public OnGameModeInit()
{


    for(new c=0;c<CAR_AMOUNT;c++) Gas[c] = GasMax; }