bamby12 Posted January 15, 2011 Share Posted January 15, 2011 i found this on an earlier topic and tried editing...but the marker dosent even show up, any ideas? function robmarkersetup() robmarker = createMarker (359.31210327148, 161.29792785645, 1008.382812, "cylinder", 4.5, 255, 0, 0, 128, getRootElement()) setElementInterior (robmarker, 3) setElementDimension (robmarker, 3) end addEventHandler("onResourceStart", getRootElement(), robmarkersetup) function bankrob (hitPlayer, matchingDimension) if (source == robmarker) then if isTimer(robbank) then cancelEvent() outputChatBox("The Bank Is Allready Being Robbed", hitPlayer, 255, 255, 0) else outputChatBox ("****BANK ROB****", hitPlayer, 255, 0, 0, false) outputChatBox ("Press X To Rob The Bank!", hitPlayer, 255, 0, 0, false) outputChatBox ("You Must Wait Here And Not Die To Get The Cash!", hitPlayer, 255, 0, 0, false) bindKey (hitPlayer, "x", "down", rob) end end end addEventHandler("onMarkerHit", getRootElement(), bankrob) bankrob = {} function rob (thePlayer, key, keystate) if (key == "x") and (keystate == "down") then outputChatBox ("***All Police To The Bank "..getPlayerName ( thePlayer ).. " Is Robbing The Bank*** ", getRootElement(), 255, 0, 0, false) setPlayerWantedLevel ( thePlayer, 4 ) robbank = setTimer( robb, 100000, 1 ) end end function robb (thePlayer) if (source ~= robmarker) then return else givePlayerMoney ( thePlayer, math.random(50000, 100000) ) setPlayerWantedLevel ( thePlayer, 6 ) end end function death() killTimer( robbank ); end addEventHandler ( "onPlayerWasted", getRootElement(), death ) i would like it so when the player steps into the marker and presses x if there is not another player allready robbing the bank then it will start the robb timer and then the player will get some money at the end of the timer then it starts again, unless they die or get arrested or something. Link to comment
SDK Posted January 15, 2011 Share Posted January 15, 2011 You do know the marker is set to dimension and interior 3? Link to comment
proracer Posted January 15, 2011 Share Posted January 15, 2011 Why did you set the dimension? Link to comment
bamby12 Posted January 15, 2011 Author Share Posted January 15, 2011 You do know the marker is set to dimension and interior 3? yeahh i set it to interior 3 because thats where i want it inside the bank... and also i set the dimension just in case i had too EDIT: holy shizza didnt know i set the dimention to 3 ill remove it and test now... Link to comment
proracer Posted January 15, 2011 Share Posted January 15, 2011 If I'm not wrong you already set position of marker with your co-ordinates so you don't need to do call 'setElementInterior'. Btw if I'm not wrong if you do 'setElementDimension' to value of 3, the player must be in that selected dimension. Link to comment
bamby12 Posted January 15, 2011 Author Share Posted January 15, 2011 (edited) If I'm not wrong you already set position of marker with your co-ordinates so you don't need to do call 'setElementInterior'.Btw if I'm not wrong if you do 'setElementDimension' to value of 3, the player must be in that selected dimension. hmm i cant see where i put the interior when i put the coordinates of the marker thats why i put it in interior 3 i took away the dimension and it still didnt show up, ok so i edited and i still cant see it, the marker shout be in interior 3 with the coordinates i gave but it isnt. Edited January 15, 2011 by Guest Link to comment
SDK Posted January 15, 2011 Share Posted January 15, 2011 https://wiki.multitheftauto.com/wiki/SetElementInterior Look at the description, it has x, y and z arguments, try it that way. (Not sure, never worked with interiors tbh) Link to comment
bamby12 Posted January 15, 2011 Author Share Posted January 15, 2011 https://wiki.multitheftauto.com/wiki/SetElementInteriorLook at the description, it has x, y and z arguments, try it that way. (Not sure, never worked with interiors tbh) yeahh thats what i did and it dosent work at all anybody got anymore ideas?? EDIT: cmon guys please help i need this. Link to comment
SDK Posted January 15, 2011 Share Posted January 15, 2011 Try looking inside the Interiors resource Link to comment
bamby12 Posted January 16, 2011 Author Share Posted January 16, 2011 Try looking inside the Interiors resource why how will that help??? somebody please fix this i know its possible. Link to comment
Castillo Posted January 16, 2011 Share Posted January 16, 2011 Is this even your script? because i seen this on a very old topic o_O Link to comment
SDK Posted January 16, 2011 Share Posted January 16, 2011 Is this even your script? because i seen this on a very old topic o_O i found this on an earlier topic and tried editing...but the marker dosent even show up, any ideas? Try looking inside the Interiors resource why how will that help??? somebody please fix this i know its possible. Afaik, that resourceshas markers inside interiors, so you could look how it's done there if no one helps you further Link to comment
bamby12 Posted January 16, 2011 Author Share Posted January 16, 2011 Ok so i got it sorted i decided to make a gui for it instead...but still have 1 problem, function robb (thePlayer) givePlayerMoney ( source, math.random(50000, 100000) ) setPlayerWantedLevel ( source, 6 ) end i get an error saying bad player pointer or something and the player dosnt get the cash or the stars?? - But i know that the timer is stated because of the output chatbox. Link to comment
proracer Posted January 16, 2011 Share Posted January 16, 2011 Try this. function robb (thePlayer) givePlayerMoney ( thePlayer, math.random(50000, 100000) ) setPlayerWantedLevel ( thePlayer, 6 ) end Because your function has "thePlayer" argument and you must use it. Link to comment
bamby12 Posted January 16, 2011 Author Share Posted January 16, 2011 Try this. function robb (thePlayer) givePlayerMoney ( thePlayer, math.random(50000, 100000) ) setPlayerWantedLevel ( thePlayer, 6 ) end Because your function has "thePlayer" argument and you must use it. nahh that did not work either, the acctual error is: warning rob.lua:17: Bad argument @ 'givePlayerMoney' EDIT: any more ideas guys please... Link to comment
Castillo Posted January 17, 2011 Share Posted January 17, 2011 tell me, how are you using the function "robb"? Link to comment
bamby12 Posted January 17, 2011 Author Share Posted January 17, 2011 tell me, how are you using the function "robb"? i made a timer that works fine to call the function, if you understand what i mean Link to comment
Castillo Posted January 17, 2011 Share Posted January 17, 2011 post your code, that must be the problem. Link to comment
bamby12 Posted January 17, 2011 Author Share Posted January 17, 2011 post your code, that must be the problem. ok here it is: addEvent("robstart", true) bankrob = {} function rob (thePlayer) if isTimer(robbank) then outputChatBox ("Somebody is allready robbing the bank", player, 255, 0, 0, false) else outputChatBox ("***All Police To The Bank Somebody is Robbing The Bank*** ", getRootElement(), 255, 0, 0, false) setPlayerWantedLevel ( source, 4 ) robbank = setTimer( robb, 10000, 1 ) end end addEventHandler ( "robstart", getRootElement(), rob ) function robb (thePlayer) givePlayerMoney ( thePlayer, math.random(50000, 100000) ) setPlayerWantedLevel ( thePlayer, 6 ) end p.s i made a gui for it that works aswell but the only thing that wont work is the give money and set wanted level under the robb runction. Link to comment
Castillo Posted January 17, 2011 Share Posted January 17, 2011 O_o, you are using many player arguments and i have no idea which is right one.. addEvent("robstart", true) bankrob = {} function rob () if isTimer(robbank) then outputChatBox ("Somebody is allready robbing the bank", source, 255, 0, 0, false) else outputChatBox ("***All Police To The Bank Somebody is Robbing The Bank*** ", getRootElement(), 255, 0, 0, false) setPlayerWantedLevel ( source, 4 ) robbank = setTimer( robb, 10000, 1, source ) end end addEventHandler ( "robstart", getRootElement(), rob ) function robb (thePlayer) givePlayerMoney ( thePlayer, math.random(50000, 100000) ) setPlayerWantedLevel ( thePlayer, 6 ) end Link to comment
bamby12 Posted January 17, 2011 Author Share Posted January 17, 2011 O_o, you are using many player arguments and i have no idea which is right one.. To be honest Snake neither do i EDIT: sorry i see youve edited it abit... ill test it now and reply here how it goes. EDIT: Thanks Snake it works now anything i can do for you just pm me. Link to comment
bamby12 Posted January 17, 2011 Author Share Posted January 17, 2011 ive got another problem... i tried to make it so that when the player dies the timer will stop but it stop the timer when any player dies here it is: function death() killTimer( robbank ) end addEventHandler ( "onPlayerWasted", getRootElement(), death ) any good ideas??? Link to comment
proracer Posted January 17, 2011 Share Posted January 17, 2011 Don't use getRootElement because it's to trigger event for every player.Try this, not sure though. function death(thePlayer) killTimer( robbank ) end addEventHandler ( "onPlayerWasted", thePlayer, death ) Link to comment
bamby12 Posted January 17, 2011 Author Share Posted January 17, 2011 Don't use getRootElement because it's to trigger event for every player.Try this, not sure though. function death(thePlayer) killTimer( robbank ) end addEventHandler ( "onPlayerWasted", thePlayer, death ) hmmm that didnt work at all now when i kill the player robbing the bank it still says that somebody is robbing Link to comment
Castillo Posted January 18, 2011 Share Posted January 18, 2011 Don't use getRootElement because it's to trigger event for every player.Try this, not sure though. function death(thePlayer) killTimer( robbank ) end addEventHandler ( "onPlayerWasted", thePlayer, death ) this makes no sense function death() if isTimer(robbank) then killTimer(robbank) end outputChatBox ("Robber has been killed.", getRootElement(), 0, 255, 0, false) end addEventHandler ( "onPlayerWasted", getRootElement(), death ) 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