Xabache Posted February 16, 2015 Posted February 16, 2015 Client: local vehicleHealth = getElementHealth ( vehicle ) / 10 triggerServerEvent( "takeRepairMoney", getLocalPlayer(), resourceRoot, vehicleHealth - 100 ) Server: function takeRepairMoney ( thePlayer, command, amount ) -- when the takeRepairMoney command is called takePlayerMoney ( thePlayer, tonumber(amount) ) -- take the amount of money from the player end addCommandHandler ( "takeRepairMoney", takeRepairMoney ) -- add a handler function for the command "takecash" It displays vehicle health but wont charge accordingly. It gives the error: [2015-02-16 06:53:48] ERROR: Client (=[T]=) triggered serverside event takeRepairMoney, but event is not added serverside. Yet it is...
Ryancit2 Posted February 16, 2015 Posted February 16, 2015 Try this at client side: triggerServerEvent( "takeRepairMoney", resourceRoot, vehicleHealth - 100 ) -- [[vehicleHealth - 100]] should be a number btw, since its the cost amount. And you are adding a command in serverside, not an event, try this one: function takeRepairMone (amount) takePlayerMoney(client,amount) end addEvent("takeRepairMoney", true) addEventHandler("takeRepairMoney", root, takeRepairMoney)
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