xXMADEXx Posted March 3, 2013 Share Posted March 3, 2013 Im making a robbing script, but im having issues with the timer. The "source" wont carry over into the timer, and i don't know how to make it.... so, it wont give the player the money. cash = math.random(3000,8000) addEventHandler("onPlayerTarget",root, function (target) if (getElementData(source,"Job")=="Robber") then if (getElementData(target,'thePoorFuckingSeller')=="fuckEmUp") then if (getElementData(source,'robbingBurgurShot')=="true") then triggerClientEvent(source,'message:addMessage',source,'Robbery: Your already robbing a fast food restaurant!') else outputChatBox("Robbery: You have started the robbbery. Don't get killed, or arrested.",source,255,255,0) setElementData(source,'robbingBurgurShot','true',true) payTimer = setTimer( function () givePlayerMoney(source,cash) outputChatBox("Robber: You have robbed Burgur Shot and have been paid $"..cash,source,0,255,0) setElementData(source,"robbingBurgurShot","false",true) end, 3000, 1 ) end end end end ) Link to comment
Guest Guest4401 Posted March 3, 2013 Share Posted March 3, 2013 cash = math.random(3000,8000) addEventHandler("onPlayerTarget",root, function (target) if (getElementData(source,"Job")=="Robber") then if (getElementData(target,':O')==":O") then if (getElementData(source,'robbingBurgurShot')=="true") then triggerClientEvent(source,'message:addMessage',source,'Robbery: Your already robbing a fast food restaurant!') else outputChatBox("Robbery: You have started the robbbery. Don't get killed, or arrested.",source,255,255,0) setElementData(source,'robbingBurgurShot','true',true) local p = source payTimer = setTimer( function () givePlayerMoney(p,cash) outputChatBox("Robber: You have robbed Burgur Shot and have been paid $"..cash,p,0,255,0) setElementData(p,"robbingBurgurShot","false",true) end, 3000, 1 ) end end end 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