Flying time help?
#1

Hi, me and my team are working on one CnR script and to get straight to the point, im interested in how to make for example. how many hours did player fly? Like we have team army and I want to make a function when player enters a hydra he gets message he doesn't have enough fying time or it can be called skill to fly it (example 30mins needed) and to track that everytime he is in plane, but just in plane and flying... so I don't want to player just enters plane go for a lunch come back and fly hydra if you understand what I'm trying to say ..
Reply
#2

Yeah don't do what DeMoo posted. Bad idea. OnPlayerUpdate(); is called 30 times a second. Its pointless checking this way.

As for what you want;

You might want to do it via a one second timer, looping through all players and checking if they're in a plane, and if they're actually moving and then increment some variable.
Reply
#3

PHP код:
new OneSecTime;
new 
Float:ZPos[MAX_PLAYERS];
stock IsAPlane(carid){switch(GetVehicleModel(carid)){case 592,577,511,512,593,520,553,476,519,460,513,548,417,487,488,497,563,447,469:return true;}return false;}
public 
OnGameModeInit()
{
    
OneSecTime SetTimer("OneSec"1000,1);
    return 
1;
}
forward OneSec();
public 
OneSec()
{
    foreach(new 
Player)
    {
        new 
Float:x,Float:y,Float:z;
        
GetPlayerPos(ixyz);
        
ZPos[i] = z;
        if(
IsAPlane(GetPlayerVehicleID(i) && ZPos[i] > 30// Change ZPos as you want
        
{
            
// Your Time Script
        
}
    }

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)