Jump to content

Different gives money


Recommended Posts

Thats the code you need to call the money from that table.

local pVehicle = getPedOccupiedVehicle(localPlayer)
local vehModel = getElementModel(pVehicle)
local pMoney = moneyTable[vehModel]
outputChatBox("That car is $" .. pMoney)

 

Link to comment

I already know NeXuS™, Why you speak?

[2017-07-22 23:37:06] WARNING: [gameplay]/moneydata/cruiseserver.lua:82: Bad argument @ 'getPedOccupiedVehicle' [Expected ped at argument 1, got nil]
[2017-07-22 23:37:06] WARNING: [gameplay]/moneydata/cruiseserver.lua:83: Bad argument @ 'getElementModel' [Expected element at argument 1, got boolean]
[2017-07-22 23:37:06] WARNING: [gameplay]/moneydata/cruiseserver.lua:90: Bad argument @ 'givePlayerMoney' [Expected number at argument 2, got nil]

I wrote to server.lua and geting that warning and I can't earn money from drive a car.

@NeXuS™ You got wrong me, I need the car gives money, not price

Link to comment
function kazan1 ()
local moneyTable = {
    [429] = math.random(5,200),
    [436] = math.random(5,25)
}
local thePlayer = getVehicleOccupant(source)
local pVehicle = getPedOccupiedVehicle(thePlayer)
local vehModel = getElementModel(pVehicle)
local pMoney = moneyTable[vehModel]

givePlayerMoney(thePlayer,pMoney)


end   
addEvent( "para5", true )
addEventHandler( "para5", root, kazan1 )

What is wrong?

Link to comment
function kazan1 ()
local moneyTable = {
    [429] = math.random(1,2),
    [436] = math.random(5,25)
}
local pVehicle = getPedOccupiedVehicle(source)
local vehModel = getElementModel(pVehicle)
local pMoney = moneyTable[vehModel]

       givePlayerMoney(source,pMoney)
end   
addEvent( "para5", true )
addEventHandler( "para5", getRootElement(), kazan1 )

That's working, ty for all my lifeguard. <3

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