Jump to content

Taxi System conversion


aski

Recommended Posts

Posted

This is system Taxi.

How to convert it took and gave the money but not the time for the meters?

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 
) 

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...