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.