Jump to content

[SOLVED]Need help give money for driving


rublisk19

Recommended Posts

Posted

What do you mean by "same effect"? it kicks you from other vehicles still?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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 !!!!

Posted (edited)

I mean if skin does not fit the player call function removePedFromVehicle

And i tested my last script and it working why rublisk19 you say it not working?

Edited by Guest

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted
exports.scoreboard:addScoreboardColumn("JOB", nil, 1.5) -- 1.5 = width. 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Well, my code worked for the dxscoreboard, not sure which one is he using.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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