Jump to content

Problem with robber job :/


Genius

Recommended Posts

When i take job then when i hit marker1 then i didnt get money and marker didnt destroyed :( and when i try /debugscript 3 no errors :/

marker = createMarker(2055.4,-1775.08,12.6,"cylinder",2, 249, 19, 75, 190 ) 
teamCriminal = createTeam( "Criminal", 249, 19, 75) 
  
  
  
  
function robber( hitPlayer, dimension ) 
setElementModel( hitPlayer,115) 
setPlayerTeam(hitPlayer,teamCriminal) 
setPlayerNametagColor(hitPlayer,249,19,75) 
  end 
addEventHandler( "onMarkerHit",marker,robber ) 
  
function start( hitPlayer, dimension ) 
marker1 = createMarker(2144.3,-1663.7,14.6,"cylinder",2, 249, 19, 75, 190, getRootElement()) 
end 
addEventHandler( "onMarkerHit",marker,start ) 
  
function hitstart( hitPlayer, dimension ) 
        givePlayerMoney (hitPlayer, 200) 
        destroyElement( marker1 ) 
end 
addEventHandler( "onMarkerHit",marker1,hitstart ) 

Link to comment

nothing in debugscript 3? realy?

marker = createMarker(2055.4,-1775.08,12.6,"cylinder",2, 249, 19, 75, 190 ) 
teamCriminal = createTeam( "Criminal", 249, 19, 75) 
  
function robber(hitPlayer) 
setElementModel(hitPlayer,115) 
setPlayerTeam(hitPlayer,teamCriminal) 
setPlayerNametagColor(hitPlayer,249,19,75) 
if marker1 then 
removeEventHandler("onMarkerHit",marker1,hitstart) 
destroyElement(marker1) 
end 
marker1 = createMarker(2144.3,-1663.7,14.6,"cylinder",2, 249, 19, 75, 190) 
addEventHandler("onMarkerHit",marker1,hitstart) 
end 
addEventHandler("onMarkerHit",marker,robber) 
  
function hitstart(hitPlayer) 
        givePlayerMoney(hitPlayer, 200) 
        destroyElement(marker1) 
end 

Link to comment

When i hit marker1 then marker2 didnt spawned :/ in debugscript3 said"Bad argument "addEventHandler"[Expected element at argument 2, got nil]

marker = createMarker(2055.4,-1775.08,12.6,"cylinder",2, 249, 19, 75, 190 ) 
teamCriminal = createTeam( "Criminal", 249, 19, 75) 
  
function robber(hitPlayer) 
setElementModel(hitPlayer,115) 
setPlayerTeam(hitPlayer,teamCriminal) 
setPlayerNametagColor(hitPlayer,249,19,75) 
if marker1 then 
removeEventHandler("onMarkerHit",marker1,hitstart) 
destroyElement(marker1) 
end 
marker1 = createMarker(2144.3,-1663.7,14.6,"cylinder",2, 249, 19, 75, 190) 
addEventHandler("onMarkerHit",marker1,hitstart) 
end 
addEventHandler("onMarkerHit",marker,robber) 
  
function hitstart(hitPlayer) 
        givePlayerMoney(hitPlayer, 886) 
        destroyElement(marker1) 
end 
  
function start12(hitPlayer) 
marker2 = createMarker(2146.3,-1470.4,25.5,"cylinder",2, 249, 19, 75, 190) 
end 
addEventHandler("onMarkerHit",marker1,start12) 
  
function hitstart1(hitPlayer) 
        givePlayerMoney(hitPlayer, 856) 
        destroyElement(marker2) 
end 
addEventHandler("onMarkerHit",marker2,hitstart1) 

Link to comment

Marker2 spawnde but when i hit marker2 then i didnt get money :/

/debugscript 3 "Bad argument"addEventHandler"[Expected element at argument 2, got nil]

marker = createMarker(2055.4,-1775.08,12.6,"cylinder",2, 249, 19, 75, 190 ) 
teamCriminal = createTeam( "Criminal", 249, 19, 75) 
  
function robber(hitPlayer) 
setElementModel(hitPlayer,115) 
setPlayerTeam(hitPlayer,teamCriminal) 
setPlayerNametagColor(hitPlayer,249,19,75) 
    outputChatBox ( "You are now Robber.", hitPlayer ) 
if marker1 then 
removeEventHandler("onMarkerHit",marker1,hitstart) 
destroyElement(marker1) 
end 
marker1 = createMarker(2144.3,-1663.7,14.6,"cylinder",2, 249, 19, 75, 190) 
addEventHandler("onMarkerHit",marker1,hitstart) 
end 
addEventHandler("onMarkerHit",marker,robber) 
  
function hitstart(hitPlayer) 
        givePlayerMoney(hitPlayer, 886) 
        destroyElement(marker1) 
    outputChatBox ( "You have robbed the house and get $886.", hitPlayer ) 
marker2 = createMarker(2146.3,-1470.4,25.1,"cylinder",2, 249, 19, 75, 190) 
end 
addEventHandler("onMarkerHit",marker1,hitstart) 
  
function hitstart1(hitPlayer) 
        givePlayerMoney(hitPlayer, 857) 
        destroyElement(marker2) 
        outputChatBox ( "You have robbed the house and get $857.", hitPlayer ) 
end 
addEventHandler("onMarkerHit",marker2,hitstart1) 

Link to comment

Wrote it in a hurry, anyhow try:

firstMarker = createMarker ( 2055.4, -1775.08, 12.6, "cylinder" ,2, 249, 19, 75, 190 ) 
secondMarker = createMarker ( 2144.3,-1663.7,14.6,"cylinder",2, 249, 19, 75, 190 ) 
thirdMarker = createMarker(2146.3,-1470.4,25.1,"cylinder",2, 249, 19, 75, 190) 
teamCriminal = createTeam( "Criminal", 249, 19, 75) 
local message = "You have robbed the house and got $857" 
  
function robber ( hitPlayer ) 
    setElementModel ( hitPlayer, 115 ) 
    setPlayerTeam ( hitPlayer, teamCriminal ) 
    setPlayerNametagColor ( hitPlayer, teamCriminal ) 
    outputChatBox ( "You are now Robber.", hitPlayer ) 
end 
addEventHandler ( "onMarkerHit", firstMarker, robber ) 
  
function onMarker1 ( thePlayer ) 
    destroyElement ( secondMarker ) 
    givePlayerMoney ( thePlayer, 856 ) 
    outputChatBox ( message, hitPlayer ) 
end 
addEventHandler ( "onMarkerHit", secondMarker, onMarker1 ) 
  
function onMarker2 ( thePlayer ) 
    destroyElement (  thirdMarker ) 
    givePlayerMoney ( thePlayer, 856 ) 
    outputChatBox ( message, hitPlayer ) 
end 
addEventHandler ( "onMarkerHit", thirdMarker, onMarker2 ) 
  
  

Link to comment
firstMarker = createMarker ( 2055.4, -1775.08, 12.6, "cylinder" ,2, 249, 19, 75, 190 ) 
teamCriminal = createTeam( "Criminal", 249, 19, 75) 
  
local random = math.random(600,1000) 
local message = "You have robbed the house and got "..random.."$" 
  
function onMarkersHit ( thePlayer ) 
    if source == firstMarker then 
        setElementModel ( thePlayer, 115 ) 
        setPlayerTeam ( thePlayer, teamCriminal ) 
        setPlayerNametagColor ( thePlayer, teamCriminal ) 
        outputChatBox ( "You are now Robber.", thePlayer ) 
        secondMarker = createMarker ( 2144.3,-1663.7,14.6,"cylinder",2, 249, 19, 75, 190 ) 
        blip1 = createBlipAttachedTo(secondMarker,32) 
    end  
    if source == secondMarker then 
        destroyElement ( secondMarker ) 
        destroyElement ( blip1 ) 
        givePlayerMoney ( thePlayer, random ) 
        outputChatBox ( message, thePlayer ) 
        thirdMarker = createMarker(2146.3,-1470.4,25.1,"cylinder",2, 249, 19, 75, 190) 
        blip2 = createBlipAttachedTo(thirdMarker,32) 
    end  
    if source == thirdMarker then 
        destroyElement (  thirdMarker ) 
        destroyElement ( blip2 ) 
        givePlayerMoney ( thePlayer, random ) 
        outputChatBox ( message, thePlayer ) 
    end      
end 
addEventHandler ( "onMarkerHit", getRootElement(), onMarkersHit ) 

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