Jump to content

Please Help Guys


bamby12

Recommended Posts

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
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 :P EDIT: holy shizza didnt know i set the dimention to 3 :P ill remove it and test now...

Link to comment
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 by Guest
Link to comment
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

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
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
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

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
O_o, you are using many player arguments and i have no idea which is right one..

To be honest Snake neither do i :P

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

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 :P here it is:

function death() 
  killTimer( robbank ) 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), death ) 

any good ideas???

Link to comment
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 :P now when i kill the player robbing the bank it still says that somebody is robbing :(

Link to comment
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...