Jump to content

[SOLVED]Need help give money for driving


rublisk19

Recommended Posts

Try this:
local timers = { } 
  
local policeSkins = { 
    [280] = true, 
    [281] = true, 
    [282] = true, 
    [283] = true, 
    [284] = true, 
    [285] = true, 
    [286] = true 
} 
  
local FireSkins = { 
    [277] = true, 
    [278] = true, 
    [279] = true 
} 
  
local medicSkins = { 
    [274] = true, 
    [275] = true, 
    [276] = true 
} 
  
local policeVehicles = { 
    [598] = true, 
    [596] = true, 
    [597] = true, 
    [599] = true 
} 
  
local FireCars = { 
    [407] = true, 
    [544] = true 
} 
  
local medicCars = { 
    [416] = true 
} 
  
  
function enterVehicle ( theVehicle, seat, jacked ) 
    if ( not policeVehicles[ getElementModel ( theVehicle ) ] and not FireCars[ getElementModel ( theVehicle ) ] and not medicCars[ getElementModel ( theVehicle ) ] ) then return end 
    if ( policeVehicles[ getElementModel ( theVehicle ) ] ) and ( policeSkins[ getElementModel ( source ) ] ) then 
        timers[source] = setTimer( payThePlayer,60000,0,source ) 
    elseif ( FireCars[ getElementModel ( theVehicle ) ] ) and ( FireSkins[ getElementModel ( source ) ] ) then 
        timers[source] = setTimer( payThePlayer1,60000,0,source ) 
    elseif ( medicCars [getElementModel ( theVehicle ) ] ) and ( medicSkins[ getElementModel ( source  ) ] ) then 
        timers[source] = setTimer( payThePlayer2,60000,0,source ) 
    else 
        removePedFromVehicle ( source ) -- force the player out of the vehicle 
        outputChatBox("You're not allowed to use this vehicle", source) 
    end 
end 
addEventHandler ( "onPlayerVehicleEnter", root, enterVehicle ) 
  
addEventHandler("onPlayerQuit",root, 
    function( ) 
        if isTimer( timers[source] ) then 
            killTimer( timers[source] ) 
        end 
        timers[source] = nil 
    end 
) 
  
function exitVehicle() 
    if isTimer( timers[source] ) then 
        killTimer( timers[source] ) 
    end 
    timers[source] = nil 
end 
addEventHandler ( "onPlayerVehicleExit", root, exitVehicle ) 
  
function payThePlayer( thePlayer ) 
    if not thePlayer then 
        if isTimer( timers[thePlayer] ) then 
            killTimer( timers[thePlayer] ) 
        end 
        return 
    end 
    setElementData( thePlayer,"MONEY",tonumber( getElementData(thePlayer, "MONEY" ) )+180 ) 
    outputChatBox ( "Jus gavote alga 180Lt!", thePlayer ) 
end 
  
function payThePlayer1( thePlayer ) 
    if not thePlayer then 
        if isTimer( timers[thePlayer] ) then 
            killTimer( timers[thePlayer] ) 
        end 
        return 
    end 
    setElementData( thePlayer,"MONEY",tonumber( getElementData( thePlayer, "MONEY" ) )+380 ) 
    outputChatBox ( "Jus gavote alga 380Lt!", thePlayer ) 
end 
  
function payThePlayer2( thePlayer ) 
    if not thePlayer then 
        if isTimer( timers[thePlayer] ) then 
            killTimer( timers[thePlayer] ) 
        end 
        return 
    end 
    setElementData( thePlayer,"MONEY",tonumber( getElementData( thePlayer, "MONEY" ) )+580 ) 
    outputChatBox ( "Jus gavote alga 580Lt!", thePlayer ) 
end 

Thanks very much works fine !!!!

Link to comment

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