KariiiM Posted August 1, 2015 Share Posted August 1, 2015 Hello guys,im scripting a simple job,everything scripted well, but i stuck on one thing , i need a good idea about triggering from side to other. To be more clear, this trigger is about givePlayerMoney ,i did it in server side and in client side i did dxDrawImage i want when i hit the marker the money numbers from server side shows in the dxDrawImage and it's in client side ,here's the part of my code: --server side: local reward = math.random (2999,5300) function deliveryDoneJob() destroyElement(burger) destroyElement(myBlip) triggerClientEvent(player,"cash",player,deliveryDoneJob) givePlayerMoney(source,reward) outputChatBox("here's your money" ..reward.. "well done!",source,0,255,231) end addEvent("doneJob", true) addEventHandler("doneJob", root, deliveryDoneJob) --client side: function money() local reward = math.random (4300,5100) end addEvent("cash", true) addEventHandler("cash", client, money) function message() dxDrawText(tonumber(reward).."$",620.0*x,395.0*y,802.0*x,466.0*y,tocolor(255,255,255,255),2.3,"pricedown","left","top",false,false,false) end Link to comment
KariiiM Posted August 1, 2015 Author Share Posted August 1, 2015 setElementData getElementData Thanks it's great way, can you give an example? Link to comment
GTX Posted August 1, 2015 Share Posted August 1, 2015 local reward = math.random (2999,5300) function deliveryDoneJob() destroyElement(burger) destroyElement(myBlip) setElementData(source, "reward", reward) givePlayerMoney(source,reward) outputChatBox("here's your money" ..reward.. "well done!",source,0,255,231) end addEvent("doneJob", true) addEventHandler("doneJob", root, deliveryDoneJob) function message() local reward = getElementData(localPlayer, "reward") if not reward then return end dxDrawText(tonumber(reward).."$",620.0*x,395.0*y,802.0*x,466.0*y,tocolor(255,255,255,255),2.3,"pricedown","left","top",false,false,false) end 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