Counter speed problem
#1

Hello, I have a problem because he wants to do and want to speed meter to show as in publicu OnPlayerUpdate, but do not want him to use it ...
Reply
#2

It's useless to create a speedometer in OnPlayerUpdate since 1) it'll be only called if the player is updating successfully informations (Won't get called if the player pressed esc or is laggy) 2) OnplayerUpdate will be called rapidly (Really fast) so use timers to calculate the speed by calculating the distance from A to B and the given amount of time where the vehicle has passed the path.
Reply
#3

and in what way can it compute?
Reply
#4

pawn Код:
public OnGameModeInit()
{
    //...
    SetTimer("SpeedometerUpdate", 200, true); //This is the timer to call the public "SpeedometerUpdate" every 200ms (1/5 s)
    //...
    return 1;
}

forward SpeedometerUpdate();

public SpeedometerUpdate()
{
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++) //This loop loops through all player ID's.
    {
        if(IsPlayerConnected(playerid)) //Checks if the player is connected
        {
            //Start here doing your speedometer system.
        }
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)