AlexWo Posted August 21, 2012 Share Posted August 21, 2012 Hi I made a "Hacker-Job" but it isn't working.... I got a console Error: Here is a Link to the screenshot: http://www.abload.de/image.php?img=errorj7jz4.png Would be nice if you could look over it and tell me what is wrong. Server Side addEvent("Bank", true) addEventHandler("Bank", root, function Bank() setElementFrozen(localPlayer, true) outputChatBox("Hacking started! It will take 5 mins to hack the Bank!", 255, 255, 0) end setTimer ( hacked, 300000, 1) ) addEvent("hacked", true) addEventHandler("hacked", root, function hacked() givePlayerMoney (localPlayer, 10000) setElementFrozen(localPlayer, false) setPlayerWantedLevel ( localPlayer, 3 ) end ) Client: HackerMarker = createMarker ( 2511, -1246, 35, "cylinder", 1.5, 255, 255, 0, 255 ) addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) local screenX, screenY = guiGetScreenSize() local width, height = 600, 600 local x = (screenX/2) - (width/2) local y = (screenY/2) - (height/2) function HackerWindow() HackWindow = guiCreateWindow(x,y,width,height,"Hacker-Job",false) guiWindowSetSizable(HackWindow,false) guiSetVisible(HackWindow, false) Hacker = guiCreateLabel(0.02,0.07,0.5,0.2,"Choose what you want to hack",true,HackWindow) button1 = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Bank", true,HackWindow ) end addEvent ("HackerWindow",true) addEventHandler ("HackerWindow",getResourceRootElement(getThisResource()),HackerWindow) function HackerWindowDestroy() destroyElement(HackerWindow) HackerWindow = false showCursor (false) end function HackerWindowClick() if source == button1 then triggerServerEvent ("Bank",getLocalPlayer()) HackWindowDestroy () elseif source == button2 then HackerWindowDestroy () end end addEventHandler("onClientGUIClick",getRootElement(),HackerWindowClick) Link to comment
Vision Posted August 21, 2012 Share Posted August 21, 2012 addEvent("Bank", true) function Bank(thePlayer) setElementFrozen(thePlayer, true) outputChatBox("Hacking started! It will take 5 mins to hack the Bank!", 255, 255, 0) end addEventHandler("Bank", root, Bank) setTimer ( hacked, 300000, 1) addEvent("hacked", true) function hacked(thePlayer) givePlayerMoney (thePlayer, 10000) setElementFrozen(thePlayer, false) setPlayerWantedLevel ( thePlayer, 3 ) end addEventHandler("hacked", root, hacked) Link to comment
AlexWo Posted August 21, 2012 Author Share Posted August 21, 2012 ok tryed this... but now its sais: setTimer[Expected fuction at Argument 1, got nil] well but "hacked" is the function... IDK maybe you know that aswell? Link to comment
CheiN Posted August 21, 2012 Share Posted August 21, 2012 Server Side addEvent("Bank", true) addEventHandler("Bank", root, function Bank() setElementFrozen(localPlayer, true) outputChatBox("Hacking started! It will take 5 mins to hack the Bank!", 255, 255, 0) end ) addEvent("hacked", true) addEventHandler("hacked", root, function hacked() givePlayerMoney (localPlayer, 10000) setElementFrozen(localPlayer, false) setPlayerWantedLevel ( localPlayer, 3 ) end setTimer ( hacked, 300000, 1 ) ) Client: HackerMarker = createMarker ( 2511, -1246, 35, "cylinder", 1.5, 255, 255, 0, 255 ) addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) local screenX, screenY = guiGetScreenSize() local width, height = 600, 600 local x = (screenX/2) - (width/2) local y = (screenY/2) - (height/2) function HackerWindow() HackWindow = guiCreateWindow(x,y,width,height,"Hacker-Job",false) guiWindowSetSizable(HackWindow,false) guiSetVisible(HackWindow, false) Hacker = guiCreateLabel(0.02,0.07,0.5,0.2,"Choose what you want to hack",true,HackWindow) button1 = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Bank", true,HackWindow ) end addEvent ("HackerWindow",true) addEventHandler ("HackerWindow",getResourceRootElement(getThisResource()),HackerWindow) function HackerWindowDestroy() destroyElement(HackerWindow) HackerWindow = false showCursor (false) end function HackerWindowClick() if source == button1 then triggerServerEvent ("Bank",getLocalPlayer()) HackWindowDestroy () elseif source == button2 then HackerWindowDestroy () end end addEventHandler("onClientGUIClick",getRootElement(),HackerWindowClick) try it Link to comment
AlexWo Posted August 21, 2012 Author Share Posted August 21, 2012 Ok but now I got an Error at the sever side again '(' expected near "Bank" Link to comment
CheiN Posted August 21, 2012 Share Posted August 21, 2012 you are calling the function like event Link to comment
AlexWo Posted August 21, 2012 Author Share Posted August 21, 2012 You know ... Im new in scripting and I don't what you mean with this sry Link to comment
CheiN Posted August 21, 2012 Share Posted August 21, 2012 im talking about: you create the function with name Bank you create the event and eventHandler with name Bank you make the same things with hacked Link to comment
AlexWo Posted August 21, 2012 Author Share Posted August 21, 2012 Ok I have it now like you posted it .... But I have the Error .... '(' expected near "Bank" Link to comment
AlexWo Posted August 21, 2012 Author Share Posted August 21, 2012 Server addEvent("Bank", true) addEventHandler("Bank", root, function Bank() setElementFrozen(localPlayer, true) outputChatBox("Hacking started! It will take 5 mins to hack the Bank!", 255, 255, 0) end ) addEvent("hacked", true) addEventHandler("hacked", root, function hacked() givePlayerMoney (localPlayer, 10000) setElementFrozen(localPlayer, false) setPlayerWantedLevel ( localPlayer, 3 ) end setTimer ( hacked, 300000, 1 ) ) Client: HackerMarker = createMarker ( 2511, -1246, 35, "cylinder", 1.5, 255, 255, 0, 255 ) addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) local screenX, screenY = guiGetScreenSize() local width, height = 600, 600 local x = (screenX/2) - (width/2) local y = (screenY/2) - (height/2) function HackerWindow() HackWindow = guiCreateWindow(x,y,width,height,"Hacker-Job",false) guiWindowSetSizable(HackWindow,false) guiSetVisible(HackWindow, false) Hacker = guiCreateLabel(0.02,0.07,0.5,0.2,"Choose what you want to hack",true,HackWindow) button1 = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Bank", true,HackWindow ) end addEvent ("HackerWindow",true) addEventHandler ("HackerWindow",getResourceRootElement(getThisResource()),HackerWindow) function HackerWindowDestroy() destroyElement(HackerWindow) HackerWindow = false showCursor (false) end function HackerWindowClick() if source == button1 then triggerServerEvent ("Bank",getLocalPlayer()) HackWindowDestroy () elseif source == button2 then HackerWindowDestroy () end end addEventHandler("onClientGUIClick",getRootElement(),HackerWindowClick) Link to comment
sockz Posted August 22, 2012 Share Posted August 22, 2012 function Bank() setElementFrozen(localPlayer, true) outputChatBox("Hacking started! It will take 5 mins to hack the Bank!", 255, 255, 0) end addEvent("Bank", true) addEventHandler("Bank", root, Bank) function hacked() givePlayerMoney (localPlayer, 10000) setElementFrozen(localPlayer, false) setPlayerWantedLevel ( localPlayer, 3 ) setTimer ( hacked, 300000, 1 ) end addEvent("hacked", true) addEventHandler("hacked", root, hacked) Link to comment
AlexWo Posted August 22, 2012 Author Share Posted August 22, 2012 Ok the errors from the Console stopped now.... The marker is also there, but if I hit the marker.... nothing happens 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