Jump to content

طلب مساعدة في وظيفة سيارة الاجرة


darhal

Recommended Posts

السلام عليكم و رحمة اللع اما بعد انا صنعت انا و صديق ليا هذا الكود لوظيفة سائق الاجرة الكود يشتغل كويس بس عندما اخذ الزبون و اوصله الماركر و البلب التالية ما تظهر بلييييييز مساعدة لأني حاولت وحدي و ما قدرت و شكراا

client side :

function beginTransport(player, seat) 
    local mod = getElementModel(source) 
    if (seat ~= 0 or player ~= localPlayer) then return end 
    if (getElementData(localPlayer, "Occupation") == "Taxi Driver") then 
        if (isElement(deliverMarker) or isElement(startMarker)) then return end 
        if (mod == 420 or mod == 438) then 
            local val = math.random(#locations) 
            local mX, mY, mZ = locations[val][1], locations[val][2], locations[val][3] 
            local area, city = getZoneName(mX, mY, mZ), getZoneName(mX, mY, mZ, true) 
            startMarker = createMarker(mX, mY, mZ - 1, "cylinder", 3, 255, 255, 0, 100) 
            startBlip = createBlipAttachedTo(startMarker, 41) 
            addEventHandler("onClientMarkerHit", startMarker, enteredStartMarker) 
            exports.UIPtexts:output("Drive to "..area..", "..city.." and pick up the client", 255, 255, 0) 
        end 
    end 
end 
addEventHandler("onClientVehicleEnter", root, beginTransport) 
  
function enteredStartMarker(plr) 
    if (plr ~= localPlayer) then return end 
    if (not isPedInVehicle(plr)) then return end 
    local v = getPedOccupiedVehicle(plr) 
    local m = getElementModel(v) 
    if (m == 420 or m == 438) then 
        destroyElement(source) 
        if (isElement(startBlip)) then destroyElement(startBlip) end 
        local i = math.random(#deliveries) 
        local mX, mY, mZ = deliveries[i][1], deliveries[i][2], deliveries[i][3] 
        local pX, pY, pZ = getElementPosition(localPlayer) 
        local area, city = getZoneName(mX, mY, mZ), getZoneName(mX, mY, mZ, true) 
        exports.UIPtexts:output("The client wants to go to "..area..", "..city.." drive there and deliver the client to get paid", 255, 255, 0) 
        distance = getDistanceBetweenPoints2D(mX, mY, pX, pY) 
        deliverMarker = createMarker(mX, mY, mZ, "cylinder", 3, 255, 255, 0, 150) 
        deliverBlip = createBlipAttachedTo(deliverMarker, 41) 
        addEventHandler("onClientMarkerHit", deliverMarker, enteredDeliverMarker) 
        triggerServerEvent("CUPtaxi.warpPed", root, v) 
    end 
end 
  
function enteredDeliverMarker(plr) 
    if (plr ~= localPlayer) then return end 
    if (not isPedInVehicle(plr)) then return end 
    local v = getPedOccupiedVehicle(plr) 
    local m = getElementModel(v) 
    if (m == 420 or m == 438) then 
        destroyElement(source) 
        if (not distance) then return end 
        if (isElement(deliverBlip)) then destroyElement(deliverBlip) end 
        triggerServerEvent("CUPtaxi.finishJob", root, math.floor(distance)) 
        distance = nil 
    end 
end 
  
function destroy() 
    if (isElement(deliverBlip) and isElement(deliverMarker)) then 
        destroyElement(deliverBlip) 
        destroyElement(deliverMarker) 
    end 
    if (isElement(startMarker) and isElement(startBlip)) then 
        destroyElement(startMarker) 
        destroyElement(startBlip) 
    end 
end 
addEvent("onClientResign", true) 
addEvent("onClientPlayerEndDuty", true) 
addEventHandler("onClientResign", root, destroy) 
addEventHandler("onClientPlayerEndDuty", root, destroy) 

server side

local ped = {} 
local payment = {} 
  
function warpPed(veh) 
    if (not isElement(client)) then return end 
    if (not isElement(veh)) then return end 
    local p = createPed(math.random(1, 200), 1, 1, 1) 
    if (not p) then 
        p = createPed(3, 1, 1, 1) 
    end 
    ped[client] = p 
    warpPedIntoVehicle(ped[client], veh, 2 or 3) 
    setVehicleTaxiLightOn(veh, true) 
end 
addEvent("CUPtaxi.warpPed", true) 
addEventHandler("CUPtaxi.warpPed", root, warpPed) 
  
function getPay(player) 
    if (payment[player]) then 
        return payment[player][1], payment[player][2] 
    else 
        return 0, 0 
    end 
end 
  
function finishJob(dist) 
    if (not isElement(client)) then return end 
    local v = getPedOccupiedVehicle(client) 
    if (not isElement(v)) then return end 
    local pay = math.floor(dist) + 150 
    if (not payment[client]) then 
        payment[client] = {0, 0} 
    end 
    local money = payment[client][1] or 0 
    local amount = payment[client][2] or 0 
    payment[client] = {money + pay, amount + 1} 
    --exports.UIPaccounts:GPM(client, pay, "UIPtaxi finished job", true) 
    exports.UIPtexts:output("You have deliveried the client to his location", client, 0, 255, 0) 
    fadeCamera(client, false, 0) 
    setElementFrozen(v, true) 
    if (isElement(ped[client])) then destroyElement(ped[client]) end 
    setTimer(fadeCamera, 1500, 1, client, true) 
    setTimer(setElementFrozen, 1500, 1, v, false) 
    setVehicleTaxiLightOn(v, false) 
    local job = exports.UIPbusiness:getPlayerJob(client) 
    --exports.UIPstats:addPlayerStat(client, job, 1) 
end 
addEvent("CUPtaxi.finishJob", true) 
addEventHandler("CUPtaxi.finishJob", root, finishJob) 
  
function givePaymentOnEndJob(jobName) 
    if (jobName == "Taxi Driver") then 
        if (payment[source]) then 
            local m = payment[source][1] or 0 
            local amount = payment[source][2] or 0 
            local m = math.floor(m) 
            payment[source] = nil 
            exports.UIPbusiness:addPayment(source, m) 
            exports.UIPaccounts:GPM(source, m, "UIPtaxi ended shift "..amount.." deliveries", true) 
            exports.UIPtexts:output("You have ended your taxi shift and made $"..m.." from "..amount.." deliveries", source, 0, 255, 0) 
        end 
    end 
end 
addEvent("onPlayerResign", true) 
addEventHandler("onPlayerResign", root, givePaymentOnEndJob) 
addEvent("onPlayerEndDuty", true) 
addEventHandler("onPlayerEndDuty", root, givePaymentOnEndJob) 
  
function givePaymentOnQuitLogout() 
    if (payment[source]) then 
        exports.UIPbusiness:addPayment(source, payment[source][1] or 0) 
        exports.UIPaccounts:GPM(source, payment[source][1] or 0, "UIPtaxi ended shift (quit)") 
    end 
end 
addEventHandler("onPlayerLogout", root, givePaymentOnQuitLogout) 
addEventHandler("onPlayerQuit", root, givePaymentOnQuitLogout) 
  
function destroyPed() 
    if (ped[source]) then 
        if (isElement(ped[source])) then 
            destroyElement(ped[source]) 
        end 
    end 
end 
addEvent("onPlayerResign", true) 
addEvent("onPlayerEndDuty", true) 
addEventHandler("onPlayerQuit", root, destroyPed) 
addEventHandler("onPlayerLogout", root, destroyPed) 
addEventHandler("onPlayerWasted", root, destroyPed) 
addEventHandler("onPlayerResign", root, destroyPed) 
addEventHandler("onPlayerEndDuty", root, destroyPed) 

plz help me urgent when I delive the client the next marker + the blip dont shown in map

I think the problem here

function destroy() 
    if (isElement(deliverBlip) and isElement(deliverMarker)) then 
        destroyElement(deliverBlip) 
        destroyElement(deliverMarker) 
    end 
    if (isElement(startMarker) and isElement(startBlip)) then 
        destroyElement(startMarker) 
        destroyElement(startBlip) 
    end 

t/debugscript 3 dont say nothing

Link to comment

try this

function beginTransport(player, seat) 
    local mod = getElementModel(source) 
    if (seat ~= 0 or player ~= localPlayer) then return end 
    if (getElementData(localPlayer, "Occupation") == "Taxi Driver") then 
        if (isElement(deliverMarker) or isElement(startMarker)) then return end 
        if (mod == 420 or mod == 438) then 
            local val = math.random(#locations) 
            local mX, mY, mZ = locations[val][1], locations[val][2], locations[val][3] 
            local area, city = getZoneName(mX, mY, mZ), getZoneName(mX, mY, mZ, true) 
            startMarker = createMarker(mX, mY, mZ - 1, "cylinder", 3, 255, 255, 0, 100) 
            startBlip = createBlipAttachedTo(startMarker, 41) 
            addEventHandler("onClientMarkerHit", startMarker, enteredStartMarker) 
            exports.UIPtexts:output("Drive to "..area..", "..city.." and pick up the client", 255, 255, 0) 
        end 
    end 
end 
addEventHandler("onClientVehicleStartEnter", root, beginTransport) 
  
function enteredStartMarker(plr) 
    if (plr ~= localPlayer) then return end 
    if (not isPedInVehicle(plr)) then return end 
    local v = getPedOccupiedVehicle(plr) 
    local m = getElementModel(v) 
    if (m == 420 or m == 438) then 
        destroyElement(source) 
        if (isElement(startBlip)) then destroyElement(startBlip) end 
        local i = math.random(#deliveries) 
        local mX, mY, mZ = deliveries[i][1], deliveries[i][2], deliveries[i][3] 
        local pX, pY, pZ = getElementPosition(localPlayer) 
        local area, city = getZoneName(mX, mY, mZ), getZoneName(mX, mY, mZ, true) 
        exports.UIPtexts:output("The client wants to go to "..area..", "..city.." drive there and deliver the client to get paid", 255, 255, 0) 
        distance = getDistanceBetweenPoints2D(mX, mY, pX, pY) 
        deliverMarker = createMarker(mX, mY, mZ, "cylinder", 3, 255, 255, 0, 150) 
        deliverBlip = createBlipAttachedTo(deliverMarker, 41) 
        addEventHandler("onClientMarkerHit", deliverMarker, enteredDeliverMarker) 
        triggerServerEvent("CUPtaxi.warpPed", root, v) 
    end 
end 
  
function enteredDeliverMarker(plr) 
    if (plr ~= localPlayer) then return end 
    if (not isPedInVehicle(plr)) then return end 
    local v = getPedOccupiedVehicle(plr) 
    local m = getElementModel(v) 
    if (m == 420 or m == 438) then 
        destroyElement(source) 
        if (not distance) then return end 
        if (isElement(deliverBlip)) then destroyElement(deliverBlip) end 
        triggerServerEvent("CUPtaxi.finishJob", root, math.floor(distance)) 
        distance = nil 
    end 
end 
  
function destroy() 
    if (isElement(deliverBlip) and isElement(deliverMarker)) then 
        destroyElement(deliverBlip) 
        destroyElement(deliverMarker) 
    end 
    if (isElement(startMarker) and isElement(startBlip)) then 
        destroyElement(startMarker) 
        destroyElement(startBlip) 
    end 
end 
addEvent("onClientResign", true) 
addEvent("onClientPlayerEndDuty", true) 
addEventHandler("onClientResign", root, destroy) 
addEventHandler("onClientPlayerEndDuty", root, destroy) 

Link to comment

معلومة بسيطة

الحرامي او المجرم بشكل عام

اذا فعل جريمته

يخفي الأدلة

انت ما شاء الله عيني عينك

أول شي كاتب لي بالعربي

وفي نص الرد

plz help me urgent when I delive the client the next marker + the blip dont shown in map

I think the problem here

ذذ

وضع يشكك صح ؟

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