Jump to content

Zamiennik Czas na Droge


Recommended Posts

Jakich funkcji i gdzie użyć aby zamiast timer liczyło po metrach/klatkach przebytych?

taxi_ids = { [420] = true, [438] = true } 
local sekundy = 5 --seconds 
local kasa = 5 --money 
  
addEventHandler ( "onVehicleEnter", root, 
    function ( player, seat ) 
        if ( taxi_ids [ getElementModel ( source ) ] ) then 
            if ( seat ~= 0 ) then 
                local kierowca = getVehicleController ( source ) 
                if ( kierowca ) then 
                    local timer = setTimer ( 
                        function ( ) 
                            takePlayerMoney ( player, kasa ) 
                            givePlayerMoney ( kierowca, kasa ) 
                        end, 
                    sekundy * 1000, 0 ) 
                    setElementData ( player, "timer:taxi", timer ) 
                end 
            end 
        end 
    end 
) 
  
addEventHandler ( "onVehicleExit", root, 
    function ( player, seat ) 
        if ( taxi_ids [ getElementModel ( source ) ] ) then 
            if ( seat ~= 0 ) then 
                local timer = getElementData ( player, "timer:taxi" ) 
                if ( isTimer ( timer ) ) then 
                    killTimer ( timer ) 
                end 
            end 
        end 
    end 
) 

Link to post
  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...