-
Posts
768 -
Joined
-
Last visited
Everything posted by Drakath
-
local accName = getAccountName ( getPlayerAccount ( p ) ) Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean] attempt to concatenate local 'accName' (a boolean value) How is it possible that getPlayerAccount returns false and how can I fix it?
-
When I'm driving a car sometimes it suddenly stops for a very short time but the speed becomes 0 so I have to gather momentum again. Is it caused by Server lag or is it something else?
-
Client: function lol () triggerServerEvent("givemoney", localPlayer, 400) end addEventHandler ( "onClientGUIClick", lolz, lol ) Server: function givecash ( thePlayer, amount ) givePlayerMoney ( thePlayer, amount ) end addEvent("givemoney", true) addEventHandler("givemoney", root, givecash) Warning: Bad argument @ 'givePlayerMoney'
-
Well, I received "cost or money do not exist." output a few times but at least there are no more errors. Thanks.
-
I tried debugging it with: outputChatBox ( tostring ( cost ) ) But all results outputted a number just like tonumber(cost) I'm not sure how do players manage to make this error. Also when I added this line: if not tonumber(cost) == nil then I couldn't buy it anymore.
-
attempt to compare nil with number if (tonumber(getPlayerMoney (source)) >= tonumber(cost)) then Is it possible that money can be nil? Or is it the cost that is nil?
-
Would it save any ram if I would disable server_auth.log?
-
Why does the server.log logs the logins? There is server_auth.log that does the same thing, so why waste ram? My suggestion is for server.log to stop log the logins.
-
TAPL's method worked. Thanks.
-
So, I'm making a Speedometer script and I keep getting this error: "addEventHandler: 'onClientRender' with this function is already handled" function speed ( ) addEventHandler ( "onClientRender", root, draw ) end addEventHandler ("onClientVehicleEnter", root, speed) function hideSpeed ( ) removeEventHandler ( "onClientRender", root, draw ) end addEventHandler("onClientVehicleExit", root, hideSpeed) function draw ( ) --this is where I have dxdraw stuff. end
-
Nice.
-
Seems like it worked. Thank you all for helping
-
It worked, but when I upgraded again, I lose the old upgrades. I tried this: addEvent( "modShop_playerLeaveModShop", true ) addEventHandler( "modShop_playerLeaveModShop", getRootElement( ), function( vehicle, itemsCost, upgrades, colors, paintjob, shopName ) local pMoney = getPlayerMoney( source ) local account = getPlayerAccount(source) if pMoney >= itemsCost and account then modTheVehicle( vehicle, upgrades, colors, paintjob, shopName ) takePlayerMoney( source, itemsCost ) triggerClientEvent( source, "modShop_moddingConfirmed", source ) local data = getAccountData (getPlayerAccount(source), "cu") local calculatedData = fromJSON ( data ) local myTable = {} for i, ups in ipairs (upgrades) do table.insert ( myTable, ups ) table.insert ( myTable, calculatedData ) end setAccountData (account, "cu",toJSON (myTable)) else outputChatBox( "#FF0000Inufficient founds! #00FF00Your pocket shows $"..tostring( getPlayerMoney( source ) )..".#FFFFFF Uninstall some upgrades.", source, 0,0,0,true) end end ) But it didn't work. Between, what does 'ups' stand for?
-
I had upgrade 1010. I upgraded two items: hydraulics and wheels. However only the first item (hydraulics) have been saved. Also I have lost upgrade 1010. addEvent( "modShop_playerLeaveModShop", true ) addEventHandler( "modShop_playerLeaveModShop", getRootElement( ), function( vehicle, itemsCost, upgrades, colors, paintjob, shopName ) local pMoney = getPlayerMoney( source ) local account = getPlayerAccount(source) if pMoney >= itemsCost and account then modTheVehicle( vehicle, upgrades, colors, paintjob, shopName ) takePlayerMoney( source, itemsCost ) triggerClientEvent( source, "modShop_moddingConfirmed", source ) local data = getAccountData (getPlayerAccount(source), "cu") local myTable = {} table.insert ( myTable, data ) table.insert ( myTable, upgrades ) setAccountData (account, "cu",toJSON (myTable)) outputChatBox( "Upgrades: "..upgrades, source, 0,0,0,true) else outputChatBox( "#FF0000Inufficient founds! #00FF00Your pocket shows $"..tostring( getPlayerMoney( source ) )..".#FFFFFF Uninstall some upgrades.", source, 0,0,0,true) end end )
-
I only need to unpack one table which is: 'upgrades'.
-
I don't want to make account data for every vehicle upgrade because it would spam the database. Anyway the problem is that it doesn't save any upgrades. It works if I put: table.insert ( myTable, 1010 ) but not when I put: table.insert ( myTable, upgs ) which means something is wrong with upgs.
-
Oh, one last, last thing. I downloaded modshop resource form community and I modified one part to setAccountData for the vehicle. addEvent( "modShop_playerLeaveModShop", true ) addEventHandler( "modShop_playerLeaveModShop", getRootElement( ), function( vehicle, itemsCost, upgrades, colors, paintjob, shopName ) local pMoney = getPlayerMoney( source ) if pMoney >= itemsCost then modTheVehicle( vehicle, upgrades, colors, paintjob, shopName ) takePlayerMoney( source, itemsCost ) triggerClientEvent( source, "modShop_moddingConfirmed", source ) local upgs = unpack(upgrades) local account = getPlayerAccount(source) local myTable = {} if account then table.insert ( myTable, upgs ) setAccountData (account, "cu",toJSON (myTable)) else outputChatBox( "#FF0000Inufficient founds! #00FF00Your pocket shows $"..tostring( getPlayerMoney( source ) )..".#FFFFFF Uninstall some upgrades.", source, 0,0,0,true) end end end ) But it kind of messes up the account data and end up with bad argument 'addVehicleUpgrade'. I tried unpacking the table to insert the ids, but it didn't work. My account data was something like this: [ [ "[ [ \"[ [ \\\"[ [ \\\\\\\"[ [ \\\\\\\\\\\\\\\"[ [ 1008 ] ]\\\\\\\\\\\\\\\", 1008 ] ]\\\\\\\", 1010 ] ]\\\", [ 1087, 1073 ]
-
if not getVehicleOccupants(getElementData (source, "car")) == 0 then Bad argument @ 'getVehicleOccupants' What's wrong?