Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2015-06-12, 18:29


P.Wiśnia

Programista LUA






Wiek: 25
Na forum: 4185 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 378

Respekt: 100
Respekt: 100



local districtsBus = {

    {45.83,1201.23,18.81},
    {-66.73,1201.60,19.59},
    {-68.33,1148.97,19.59},
    {24.26,1144.16,19.59},
    {26.12,1102.61,19.59},
    {-65.06,1101.15,19.59},
    {-185.69,1100.93,19.60},
    {-188.17,1193.49,19.55},
    {-115.97,1196.37,19.59},
    {-117.24,1251.94,17.41},
    {-73.71,1256.68,12.09},
    {64.41,1220.31,18.83},
   
}

local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsBus

function finishJob()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    if jobTarget and isElement(jobTarget) then
        destroyElement(jobTarget)
        jobTarget = nil
        jobTarget = 0
        
    end
    
triggerServerEvent("destroyVeh", localPlayer)

end


function busDriver(el, md)
    if el ~= localPlayer or not md then return end
    if jobTarget > maxTarget and getPedOccupiedVehicle(el) then return end
    if jobTarget == maxTarget and not getPedOccupiedVehicle(el) then return end
    
    if jobTarget == #districtsBus then
        finishJob()
        playSoundFrontEnd(5)
        outputChatBox("* Zako?czy?e?/a? prac?.")
    else
        showMarker()
        playSoundFrontEnd(12)
        triggerServerEvent("givePlayerMoney", localPlayer, 3, 0)
    end
end

function showMarker()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    jobTarget = jobTarget + 1
    jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint", 4, 0, 0, 255)
    
    if districtsBus[jobTarget+1] then
        ile = districtsBus[jobTarget+1]
        setMarkerTarget(jobMarker, ile[1], ile[2], ile[3])
    end
    
    addEventHandler("onClientMarkerHit", jobMarker, busDriver)
end

addEvent("STARTJobBus", true)
addEventHandler("STARTJobBus", resourceRoot, function(veh)
    outputChatBox("* Rozpocz??e?/a? prac?.")
    jobVehicle = veh
    jobTarget = 0
    showMarker()
end)

addEventHandler("onClientResourceStop", resourceRoot, function()
    if jobVehicle and getElementData(localPlayer, "gracz_praca") then
        setElementData(localPlayer, "gracz_praca", false)
    end
end)

addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
    if seat == 0 then
        if plr == localPlayer then
            finishJob()
            outputChatBox("* Zako?czy?e? prac?")
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-12, 20:18


PolskiSebek12

Programista






Wiek: 28
Na forum: 4488 dni
Posty: 343
Nick w MP: CrosRoad95

Piwa: 3887

Respekt: 288,8
Respekt: 288,8Respekt: 288,8Respekt: 288,8

Ostrzeżeń: 100%
kolejna osoba kt?ra nie my?li ...
sk?d mam ja i inne osoby wiedzie? jak ma to dzia?a? ?

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-06-13, 00:06


serek123

Lua, MySql, Sql






Wiek: 27
Na forum: 4475 dni
Posty: 217
Nick w MP: Serek.

Piwa: 375

Respekt: 70

Masz Server po raz kolejny to jest ju? wstawione

--[[
    (c) 2014 GO-Life.pl All rights reserved.
    
    #Author: Split <[email protected]>
    #version: 1.0 

    You have no right to use this code without my permission.
    Write to me maybe to agree to use the code.
    --]]
addEvent("takePlayerMoney", true)
addEventHandler("takePlayerMoney", root, function(money)
    if not tonumber(money) then return end
    takePlayerMoney(source, tonumber(money))
end)

addEvent("givePlayerMoney", true)
addEventHandler("givePlayerMoney", root, function(money, gp)
    if not tonumber(money) or not tonumber(gp) then return end
    local sctera = getElementData(source, "GP") or 0

    givePlayerMoney(source, money)
    
    setElementData(source, "GP", tonumber(sctera) + tonumber(gp))

    exports.notification:showBox(source, "info","")
end)

licze na piwko

Postaw piwo autorowi tego posta
 

 
Tagi: jak :: zrobić :: server.lua :: tego :: skryptu
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku