Newbie Posted February 12, 2014 Share Posted February 12, 2014 (edited) function car( player, cmd ) local account = ( ( getPlayerAccount( player ) and not isGuestAccount( getPlayerAccount( player ) ) ) and getPlayerAccount( player ) or false ) if ( account ) then local cashHave = tonumber( getAccountData( account, "cash" ) ) if ( cashHave ) and ( cashHave >= 1 ) then setTimer(setElementModel,1000,1,vehicle,math.random(399, 609)) outputChatBox( "* " .. getPlayerName( player ) .. " bought a random car.", root, 255, 255, 255, false ) setAccountData( account, "cash", cashHave - 1 ) else outputChatBox( "* You need more cash.", player, 255, 255, 255, false ) end else outputChatBox( "* You're not logged in.", player, 255, 255, 255, false ) end end addCommandHandler( "car", car ) I should get a random car, but i dont. Edited February 12, 2014 by Guest Link to comment
Castillo Posted February 12, 2014 Share Posted February 12, 2014 'vehicle' is not defined anywhere. Link to comment
Newbie Posted February 12, 2014 Author Share Posted February 12, 2014 'vehicle' is not defined anywhere. How i should define it ? Link to comment
manawydan Posted February 12, 2014 Share Posted February 12, 2014 getPedOccupiedVehicle Link to comment
Newbie Posted February 12, 2014 Author Share Posted February 12, 2014 function car( player, cmd ) local account = ( ( getPlayerAccount( player ) and not isGuestAccount( getPlayerAccount( player ) ) ) and getPlayerAccount( player ) or false ) if ( account ) then local cashHave = tonumber( getAccountData( account, "cash" ) ) if ( cashHave ) and ( cashHave >= 1 ) then local vehicle = getPedOccupiedVehicle(player) setTimer(setElementModel,1000,1,vehicle,math.random(399, 609)) outputChatBox( "* " .. getPlayerName( player ) .. " bought a random car.", root, 255, 255, 255, false ) setAccountData( account, "cash", cashHave - 1 ) else outputChatBox( "* You need more cash.", player, 255, 255, 255, false ) end else outputChatBox( "* You're not logged in.", player, 255, 255, 255, false ) end end addCommandHandler( "car", car ) Did it! Thanks for help. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now