Jump to content

Script Errors:


Recommended Posts

in this script i got errors. please help:

function mission1 (hitElement) 
local mission1Marker = createMarker (2000.58984375, -1733.0361328125, 13.3828125, 'cylinder', 2.0, 255, 0, 0, 150) 
if getElementType ( hitElement ) == "player" and not isPedInVehicle(hitElement) then 
triggerClientEvent ("ShowWinWindow", hitElement) 
end 
end 
addEvent ("missionStarts", true) 
addEventHandler ("missionStarts", getRootElement(), mission1) 
addEventHandler ("onMarkerHit", mission1Marker, mission1) 
  
function onLeave () 
local money = math.random(2000, 2500) 
givePlayerMoney (source, money) 
outputChatBox ("You have got "..money.."$ Good Job!", source, 0, 255, 0, false) 
destroyElement (mission1Marker) 
end 
addEvent ("GetRewards", true) 
addEventHandler ("GetRewards", getRootElement(), onLeave) 

Bad argument @ 'addEventHandler [Expected element at argument 2, got nil' 

Edited by Guest
Link to comment
local mission1Marker = createMarker (2000.58984375, -1733.0361328125, 13.3828125, 'cylinder', 2.0, 255, 0, 0, 150) 
function mission1 () 
addEventHandler ("onMarkerHit", mission1Marker, onHit) 
if getElementType ( hitElement ) == "player" and not isPedInVehicle(hitElement) then 
triggerClientEvent ("ShowWinWindow", hitElement) 
end 
end 
addEvent ("missionStarts", true) 
addEventHandler ("missionStarts", getRootElement(), mission1) 
addEventHandler ("onMarkerHit", mission1Marker, mission1) 
  
function onLeave () 
local money = math.random(2000, 2500) 
givePlayerMoney (source, money) 
outputChatBox ("You have got 2000$ Good Job!", source, 0, 255, 0, false) 

Link to comment
local mission1Marker = createMarker (2000.58984375, -1733.0361328125, 13.3828125, 'cylinder', 2.0, 255, 0, 0, 150) 
function mission1 () 
addEventHandler ("onMarkerHit", mission1Marker, onHit) 
if getElementType ( hitElement ) == "player" and not isPedInVehicle(hitElement) then 
triggerClientEvent ("ShowWinWindow", hitElement) 
end 
end 
addEvent ("missionStarts", true) 
addEventHandler ("missionStarts", getRootElement(), mission1) 
addEventHandler ("onMarkerHit", mission1Marker, mission1) 
  
function onLeave () 
local money = math.random(2000, 2500) 
givePlayerMoney (source, money) 
outputChatBox ("You have got 2000$ Good Job!", source, 0, 255, 0, false) 

alright i've tried it:

fixed things here but still there's problem

this make the marker spawn already. whatever i want the marker spawn when the player click on the gui button. thats why i have triggerd and putted marker on function. so :/?

    local mission1Marker = createMarker (2000.58984375, -1733.0361328125, 13.3828125, 'cylinder', 2.0, 255, 0, 0, 150) 
    function mission1 (hitElement) 
    addEventHandler ("onMarkerHit", mission1Marker, onHit) 
    if getElementType ( hitElement ) == "player" and not isPedInVehicle(hitElement) then 
    triggerClientEvent ("ShowWinWindow", hitElement) 
    end 
    end 
    addEvent ("missionStarts", true) 
    addEventHandler ("missionStarts", getRootElement(), mission1) 
    addEventHandler ("onMarkerHit", mission1Marker, mission1) 
      
    function onLeave () 
    local money = math.random(2000, 2500) 
    givePlayerMoney (source, money) 
    outputChatBox ("You have got "..money.."$ Good Job!", source, 0, 255, 0, false) 
end 
    addEvent ("GetRewards", true) 
    addEventHandler ("GetRewards", getRootElement(), onLeave) 

Link to comment

ok i have tried it:

    function mission1 (hitElement) 
    local mission1Marker = createMarker (2000.58984375, -1733.0361328125, 13.3828125, 'cylinder', 2.0, 255, 0, 0, 150) 
    if getElementType ( hitElement ) == "player" and not isPedInVehicle(hitElement) then 
    triggerClientEvent ("ShowWinWindow", hitElement) 
    end 
    end 
    addEvent ("missionStarts", true) 
    addEventHandler ("missionStarts", getRootElement(), mission1) 
    addEventHandler ("onMarkerHit", mission1Marker, mission1) 
      
    function onLeave () 
    local money = math.random(2000, 2500) 
    givePlayerMoney (source, money) 
    outputChatBox ("You have got "..money.."$ Good Job!", source, 0, 255, 0, false) 
end 
    addEvent ("GetRewards", true) 
    addEventHandler ("GetRewards", getRootElement(), onLeave) 

Still error:

:31: addEventHandler  argument 2 got nil  

Link to comment
ok i have tried it:
    function mission1 (hitElement) 
    local mission1Marker = createMarker (2000.58984375, -1733.0361328125, 13.3828125, 'cylinder', 2.0, 255, 0, 0, 150) 
    if getElementType ( hitElement ) == "player" and not isPedInVehicle(hitElement) then 
    triggerClientEvent ("ShowWinWindow", hitElement) 
    end 
    end 
    addEvent ("missionStarts", true) 
    addEventHandler ("missionStarts", getRootElement(), mission1) 
    addEventHandler ("onMarkerHit", mission1Marker, mission1) 
      
    function onLeave () 
    local money = math.random(2000, 2500) 
    givePlayerMoney (source, money) 
    outputChatBox ("You have got "..money.."$ Good Job!", source, 0, 255, 0, false) 
end 
    addEvent ("GetRewards", true) 
    addEventHandler ("GetRewards", getRootElement(), onLeave) 

Still error:

:31: addEventHandler  argument 2 got nil  

Client side too:

function missionClick (button, state) 
    if (button == "left" and state == "up") then 
    guiSetVisible (GUIEditor.window[1], false) 
    showCursor ( false ) 
    triggerServerEvent ("missionStarts", localPlayer) 
    end 
end 

Link to comment

the script'd be now:

function mission1 () 
    local mission1Marker = createMarker (2000.58984375, -1733.0361328125, 13.3828125, 'cylinder', 2.0, 255, 0, 0, 150) 
end 
    addEvent ("missionStarts", true) 
    addEventHandler ("missionStarts", getRootElement(), mission1) 
function onHit (hitElement) 
    if getElementType ( hitElement ) == "player" and not isPedInVehicle(hitElement) then 
    triggerClientEvent ("ShowWinWindow", hitElement) 
    end 
end 
addEventHandler ("onMarkerHit", mission1Marker, onHit) 
    function onLeave () 
    local money = math.random(2000, 2500) 
    givePlayerMoney (source, money) 
    outputChatBox ("You have got "..money.."$ Good Job!", source, 0, 255, 0, false) 
end 
    addEvent ("GetRewards", true) 
    addEventHandler ("GetRewards", getRootElement(), onLeave) 

but i got error:

:34:bad argument 'addEventHandler' element at argument 2, got nil 

Link to comment
the script'd be now:
function mission1 () 
    local mission1Marker = createMarker (2000.58984375, -1733.0361328125, 13.3828125, 'cylinder', 2.0, 255, 0, 0, 150) 
end 
    addEvent ("missionStarts", true) 
    addEventHandler ("missionStarts", getRootElement(), mission1) 
function onHit (hitElement) 
    if getElementType ( hitElement ) == "player" and not isPedInVehicle(hitElement) then 
    triggerClientEvent ("ShowWinWindow", hitElement) 
    end 
end 
addEventHandler ("onMarkerHit", mission1Marker, onHit) 
    function onLeave () 
    local money = math.random(2000, 2500) 
    givePlayerMoney (source, money) 
    outputChatBox ("You have got "..money.."$ Good Job!", source, 0, 255, 0, false) 
end 
    addEvent ("GetRewards", true) 
    addEventHandler ("GetRewards", getRootElement(), onLeave) 

but i got error:

:34:bad argument 'addEventHandler' element at argument 2, got nil 

i've made it. but still the same error:

function mission1 () 
    local mission1Marker = createMarker (2000.58984375, -1733.0361328125, 13.3828125, 'cylinder', 2.0, 255, 0, 0, 150) 
    if getElementType ( source ) == "player" and not isPedInVehicle(source) then 
    triggerClientEvent ("ShowWinWindow", source) 
end 
end 
    addEvent ("missionStarts", true) 
    addEventHandler ("missionStarts", getRootElement(), mission1) 
    addEventHandler ("onMarkerHit", mission1Marker, mission1) 

Link to comment
function mission1 () 
    local mission1Marker = createMarker (2000.58984375, -1733.0361328125, 13.3828125, 'cylinder', 2.0, 255, 0, 0, 150) 
    addEventHandler ("onMarkerHit", mission1Marker, onHit) 
end 
addEvent ("missionStarts", true) 
addEventHandler ("missionStarts", getRootElement(), mission1) 
  
function onHit (hitElement) 
    if getElementType ( hitElement ) == "player" and not isPedInVehicle(hitElement) then 
    triggerClientEvent ("ShowWinWindow", hitElement) 
    end 
end 
  
function onLeave () 
    local money = math.random(2000, 2500) 
    givePlayerMoney (source, money) 
    outputChatBox ("You have got "..money.."$ Good Job!", source, 0, 255, 0, false) 
end 
addEvent ("GetRewards", true) 
addEventHandler ("GetRewards", getRootElement(), onLeave) 

Link to comment
function mission1 () 
    local mission1Marker = createMarker (2000.58984375, -1733.0361328125, 13.3828125, 'cylinder', 2.0, 255, 0, 0, 150) 
    addEventHandler ("onMarkerHit", mission1Marker, onHit) 
end 
addEvent ("missionStarts", true) 
addEventHandler ("missionStarts", getRootElement(), mission1) 
  
function onHit (hitElement) 
    if getElementType ( hitElement ) == "player" and not isPedInVehicle(hitElement) then 
    triggerClientEvent ("ShowWinWindow", hitElement) 
    end 
end 
  
function onLeave () 
    local money = math.random(2000, 2500) 
    givePlayerMoney (source, money) 
    outputChatBox ("You have got "..money.."$ Good Job!", source, 0, 255, 0, false) 
end 
addEvent ("GetRewards", true) 
addEventHandler ("GetRewards", getRootElement(), onLeave) 

Yeah works with that: but

    function mission1 () 
        local mission1Marker = createMarker (2000.58984375, -1733.0361328125, 13.3828125, 'cylinder', 2.0, 255, 0, 0, 150) 
        addEventHandler ("onMarkerHit", mission1Marker, onHit) 
  
    end 
    addEvent ("missionStarts", true) 
    addEventHandler ("missionStarts", getRootElement(), mission1) 
      
    function onHit (hitElement) 
        if getElementType ( hitElement ) == "player" and not isPedInVehicle(hitElement) then 
        triggerClientEvent ("ShowWinWindow", hitElement) 
        end 
    end 
  
    function DAR () 
    destroyElement (mission1Marker) 
    end 
    addEvent ("destroyAndReward", true) 
    addEventHandler ("destroyAndReward", getRootElement(), DAR) 

client:

function CloseBtn () 
guiSetVisible (GUIEditor.window[1], false) 
showCursor ( false ) 
triggerServerEvent ("destroyAndReward", localPlayer) 
end 

i've tried to destroy the marker when the player click on the button. but not works. please help :/

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