Jump to content

[Help] Marker doesn't work


roy_ppp

Recommended Posts

This server

local target 
local random 
function startwork(source, cmd) 
        local playeraccount = getPlayerAccount( source ) 
            if playeraccount then 
            local job = getAccountData(playeraccount, "Data.job") 
                if job == "Oiler" then 
                local name = getPlayerName(source) 
                local cangetnew = getElementData(source, "Cangetnew") 
                    if cangetnew ~= false  then 
                    setElementData(source, "Cangetnew", false) 
                    random = math.random(1, 4) 
                        if random == 1 then 
                        triggerClientEvent("TargetCreate", source, 1937.13, -1772.02, 12.6, name) 
                        elseif random == 2 then 
                        triggerClientEvent("TargetCreate", source, 999, -897.50, 42.24, name) 
                        elseif random == 3 then 
                        triggerClientEvent("TargetCreate", source, -91.05, -1169.08, 2.6, name) 
                        elseif random == 4 then 
                        triggerClientEvent("TargetCreate", source, -1605.80, -2714.51, 48.6, name) 
                        end 
                    else 
                    end 
                end 
            end 
end 
addCommandHandler("work", startwork) 

and client

local target 
local own 
local blip 
function CreateTarget(x,y,z, ownn) 
own = ownn 
target = createMarker(x,y,z,'checkpoint',2,255,0,0,255) 
blip = createBlip ( x,y,z,0,3,255,0,0,255) 
addEventHandler("onClientMarkerHit", target, function(hitPlayer, matchingDimension) 
local element = getElementType(hitPlayer) 
outputChatBox("1") 
    if element == "Vehicle" then 
    local model = getElementID(element) 
    outputChatBox("2") 
        if element == 584 then 
            outputChatBox("3") 
            local who = getElementData(element) 
            if who == own then 
            outputChatBox("4") 
                local he = getPlayerFromName(own) 
                local givemoney = math.random(400, 700) 
                outputChatBox("you got " .. givemoney .. " $") 
                givePlayerMoney(own, givemoney) 
                setElementData(own, "Cangetnew", true) 
                destroyElement(blip) 
                destroyElement(target) 
            end 
        end 
    end 
end 
) 
end 
addEvent("TargetCreate", true) 
addEventHandler("TargetCreate", getLocalPlayer(), CreateTarget) 

end

Sorry for late and sorry for my bad english again. :|

Link to comment
This server
local target 
local own 
local blip 
function CreateTarget(x,y,z, ownn) 
own = ownn 
target = createMarker(x,y,z,'checkpoint',2,255,0,0,255) 
blip = createBlip ( x,y,z,0,3,255,0,0,255) 
addEventHandler("onClientMarkerHit", target, function(hitPlayer, matchingDimension) 
local element = getElementType(hitPlayer) 
outputChatBox("1") 
    if element == "Vehicle" then 
    local model = getElementID(element) 
    outputChatBox("2") 
        if element == 584 then 
            outputChatBox("3") 
            local who = getElementData(element) 
            if who == own then 
            outputChatBox("4") 
                local he = getPlayerFromName(own) 
                local givemoney = math.random(400, 700) 
                outputChatBox("you got " .. givemoney .. " $") 
                givePlayerMoney(own, givemoney) 
                setElementData(own, "Cangetnew", true) 
                destroyElement(blip) 
                destroyElement(target) 
            end 
        end 
    end 
end 
) 
end 
addEvent("TargetCreate", true) 
addEventHandler("TargetCreate", getLocalPlayer(), CreateTarget) 

end

Sorry for late and sorry for my bad english again.

This

local model = getElementID(element) 

should be

local model = getElementModel(element) 

and this

if element == 584 then 

should be

if model == 584 then 

and here you didn't put dataName -_-"

local who = getElementData(element) 

also here 'own' is player name not element -_-"

local he = getPlayerFromName(own) 
local givemoney = math.random(400, 700) 
outputChatBox("you got " .. givemoney .. " $") 
givePlayerMoney(own, givemoney) 
setElementData(own, "Cangetnew", true) 

also the type here

if element == "Vehicle" then 

should be

if element == "vehicle" then 

https://wiki.multitheftauto.com/wiki/Element/Vehicle

Link to comment

no no i show some code in my script

but i just want to ask , How to do marker get element of vehicle 584.

Cause when i drag 584 to marker, it not work.

ps. i change getElementID to getElementModel now but not work

** sorry for my bad english

Link to comment
no no i show some code in my script

but i just want to ask , How to do marker get element of vehicle 584.

Cause when i drag 584 to marker, it not work.

ps. i change getElementID to getElementModel now but not work

** sorry for my bad english

I've told you about the errors in your code, now you should fix it and if it doesn't work post it .

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