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

Wysłany: 2018-04-12, 21:35


readreis







Wiek: 37
Na forum: 3908 dni
Posty: 62

Piwa: 4

Respekt: 50

Witam ma taki problem i? gracze moga bi? kilofem podczas pracy wydaje mi sie, ?e w skrypcie wszystko sie zgadza ale moge sie mylic.

server:
local weapon_id 4
local category_animation "BASEBALL"
local digging_animation "bat_4"

--str="(odswie?anie: 10 sekund)\nRanking pracy (kopalnia):"
--local t=createElement("text")
--setElementData(t,"name",str)
--setElementPosition(t,-2090.77, -1535.0977.80+1.5)

--function aktualizujText()
--local q=exports["ogrpg-db"]:dbGet("select * from job_top_gornik order by ilosc desc limit 10")
--str="(odswie?anie: 10 sekund)\nRanking pracy (kopalnia):"
--for i,v in ipairs(q) do
--iii=i
--local nick=exports["ogrpg-db"]:dbGet("select login,login2 from ogrpg_users where id=?"v["uid"])
--for i2,v2 in ipairs(nick) do
--if i2 1 then return end
--if v2["login2"] == false then
--str=""..str.."\n"..iii..". "..v2["login"].." - "..v["ilosc"].." wydobytych surowc?w"
--else
--str=""..str.."\n"..iii..". "..v2["login2"].." - "..v["ilosc"].." wydobytych surowc?w"
--end
--end
--end
--setElementData(t"name"str)
--end
--setTimer(aktualizujText100000)

function give_weapon()
giveWeapon(sourceweapon_id1)
setPedWeaponSlot(source1)
end
addEvent("kilof"trueaddEventHandler("kilof"getRootElement(), give_weapon)

function animation()
setPedAnimation(source"BASEBALL""Bat_4")
end
addEvent("animation"trueaddEventHandler("animation"getRootElement(), animation)

function end_job()
setPedAnimation(sourcefalse)
takeWeapon(sourceweapon_id)
end
addEvent("end_job"trueaddEventHandler("end_job"getRootElement(), end_job)

function koniec_animka()
setPedAnimation(sourcefalse)
end
addEvent("end_animation"trueaddEventHandler("end_animation"getRootElement(), koniec_animka)

addEvent("hajsikkopalnia",true)
addEventHandler("hajsikkopalnia",root,function(kwota)
givePlayerMoney(clientkwota)
end)

local t=createElement("text")
setElementData(t,"scale",1.2)
setElementData(t,"name","Wej?cie do kopalni")
setElementInterior(t,0)
setElementDimension(t,0)
setElementPosition(t,-2008.15,-1503.74,94.74+0.2)
createBlipAttachedTo (t46)

local t=createElement("text")
setElementData(t,"scale",1.2)
setElementData(t,"name","Wyj?cie z kopalni")
setElementInterior(t,0)
setElementDimension(t,0)
setElementPosition(t,2538.19,-4264.39,319.16+0.2)

door createMarker (-2008.15,-1503.74,94.74+0.5"arrow"1.5025519950)
setElementDimension(door0)
setElementInterior(door0)

addEventHandler("onMarkerHit"door, function(elmd)
    if getElementType(el) ~= "player" then return end
    if isPedInVehicle(elthen return end
    setElementDimension(el0)
    setElementInterior(el0)
    setElementPosition(el2543.40,-4276.06,319.15)
end)


client:
local job_marker createMarker(2540.31,-4275.68,319.15-0.9"cylinder"1255255060)
local job_marker_cancel createMarker(2537.29,-4274.15,319.15-0.9"cylinder"12550050)
local time_freeze math.random(6000,9000)
local name_job "wydobywania surowc?w mineralnych"
local button_job "e"
local button_state "down"
local digging_animation "bat_4"
local swsh guiGetScreenSize()


local rozpoczecie createElement("text")
setElementData(rozpoczecie"name""Praca g?rnika\nZarobki: 7-15 PLN\nKonto premium x1.3")
setElementPosition(rozpoczecie,2540.31,-4275.68,319.15)

local anulowanie createElement("text")
setElementData(anulowanie"name""Anulowanie pracy\nAby zako?czy?, wci?nij 'E'!")
setElementPosition(anulowanie2537.29,-4274.15,319.15+0.10)


local points = {
{2533.41,-4303.64,319.16},
{2527.03,-4302.24,319.16},
{2516.57,-4303.02,319.16},
{2507.36,-4303.87,319.16},
{2499.89,-4303.01,319.16},
{2503.08,-4312.34,319.16},
{2490.66,-4321.37,319.16},
{2481.48,-4329.13,319.16},
{2494.20,-4341.20,319.15},
{2502.44,-4339.79,319.15},
{2509.90,-4343.29,319.15},
{2532.28,-4337.73,319.16},
{2538.70,-4341.39,319.16},
{2543.33,-4331.29,319.16},
{2562.74,-4330.16,319.16},
{2564.67,-4317.71,319.16},
{2561.79,-4305.65,319.16},
{2542.92,-4296.89,319.15},
{2541.80,-4286.40,319.15},
{2532.97,-4283.27,319.15},
{2513.80,-4286.10,319.15},
{2535.32,-4306.41,319.16},
{2542.81,-4296.29,319.15},
{2545.23,-4328.79,319.78},
{2535.73,-4302.45,322.13},
{2518.81,-4303.76,322.21},
{2526.57,-4281.26,322.77},
{2496.01,-4303.22,322.28},
{2483.64,-4333.83,323.05},
{2492.24,-4356.38,322.82},
{2479.03,-4355.09,320.81},
{2454.80,-4353.29,328.25},
{2463.74,-4323.37,319.16},
{2479.40,-4306.67,322.23},
{2484.84,-4295.74,319.16},
}

local nazwy = {
    "rudy ?elaza",
    "w?gla brunatnego",
    "w?gla kamiennego",
    "rudy z?ota",
    "rudy diamentu",
    "rudy szmaragdu",
    "rudy miedzi",
    "soli kamiennej",
    "granitu",
}

local objective
local draw
local draw 0
local element_type "player"

function isEventHandlerAddedsEventNamepElementAttachedTofunc )
    if typesEventName ) == 'string' and isElementpElementAttachedTo ) and typefunc ) == 'function' then
        local aAttachedFunctions getEventHandlerssEventNamepElementAttachedTo )
        if typeaAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
            for iv in ipairsaAttachedFunctions ) do
                if == func then
                    return true
                end
            end
        end
    end
    return false
end

local function postep()
    local pasek interpolateBetween(000sw 0.429700, (getTickCount()-time)/time_freeze"InOutQuad")
    dxDrawText("Post?p:", (sw 0.2855) + 0.8, (sh 0.2422) + 0.8, (sw 0.4407) + 0.8, (sh 0.2799) + 0.8tocolor(000255), 3.00"default-bold""left""top"falsefalsefalsetruefalse)
    dxDrawText("Post?p:"sw 0.2855sh 0.2422sw 0.4407sh 0.2799tocolor(255255255255), 3.00"default-bold""left""top"falsefalsefalsetruefalse)
    dxDrawLine((sw 0.2855) - 1, (sh 0.3060) - 1, (sw 0.2855) - 1sh 0.3659tocolor(000200), 1false)
    dxDrawLine(sw 0.7152, (sh 0.3060) - 1, (sw 0.2855) - 1, (sh 0.3060) - 1tocolor(000200), 1false)
    dxDrawLine((sw 0.2855) - 1sh 0.3659sw 0.7152sh 0.3659tocolor(000200), 1false)
    dxDrawLine(sw 0.7152sh 0.3659sw 0.7152, (sh 0.3060) - 1tocolor(000200), 1false)
    dxDrawRectangle(sw 0.2855sh 0.3060sw 0.4297sh 0.0600tocolor(000170), false)
    dxDrawRectangle(sw 0.2855sh 0.3060paseksh 0.0600tocolor(01784255), false)
end

local function hitmarker(playermd)
    if not md or getElementType(player) ~= element_type then return end
    if player ~= localPlayer then return end
    outputChatBox("Aby rozpocz?? prac? "..name_job.." wci?nij klawisz '"..button_job.."'.")
end
addEventHandler("onClientMarkerHit"job_markerhitmarker)

local function startjob()
    if not isElementWithinMarker(localPlayerjob_markerthen return end
    if getElementData(localPlayer"player:miner") == true then exports["noti"]:noti("* Posiadasz aktywn? prac?!"25500true) return end
    if getPedOccupiedVehicle(localPlayer) == true then exports["noti"]:noti("* Nie mo?esz by? w poje?dzie!"25500false) return end
    setElementData(localPlayer"player:miner"true)
    outputChatBox("Rozpocz??e?(a?) prac? "..name_job..", id? wydoby? surowiec zaznaczony blipem 'C' na minimapie.")
    toggleControl("sprint"falsetoggleControl("jump"falsetoggleControl("crouch"falsetoggleControl("next_weapon"falsetoggleControl("previous_weapon"falsetoggleControl("fire"false)
    triggerServerEvent("kilof"localPlayer)
    job_stage(localPlayer)
end
bindKey(button_jobbutton_statestartjob)

local function canceljob()
    if not isElementWithinMarker(localPlayerjob_marker_cancelthen return end
    if getElementData(localPlayer"player:miner") == false then outputChatBox("Nie posiadasz aktywnej pracy!") return end
    if getPedOccupiedVehicle(localPlayer) == true then outputChatBox("Nie mo?esz by? w poje?dzie!") return end
    outputChatBox("Zako?czy?e?(a?) prac? "..name_job..".")
    toggleControl("sprint"truetoggleControl("jump"truetoggleControl("crouch"truetoggleControl("next_weapon"truetoggleControl("previous_weapon"true)
    if isElement(objective) and isElement(blip) and isElement(rocks) and isElement(textthen
    destroyElement(objective)
    destroyElement(blip)
    destroyElement(rocks)
    destroyElement(text)
    end
    if isEventHandlerAdded("onClientRender"rootpostepthen
    removeEventHandler("onClientRender"rootpostep)
    end
    triggerServerEvent("end_job"localPlayer)
    setElementData(localPlayer"player:miner"false)
end
bindKey(button_jobbutton_statecanceljob)

function job_stage(playermd)
    if (objective) and isElement(objectivethen
    destroyElement(objective)
    destroyElement(blip)
    destroyElement(rocks)
    objective nil
    end
    toggleControl("sprint"falsetoggleControl("jump"falsetoggleControl("crouch"falsetoggleControl("next_weapon"falsetoggleControl("previous_weapon"falsetoggleControl("fire"false)
    local losuj math.random(2#points)
    local miner points
    objective createMarker(miner[losuj][1], miner[losuj][2], miner[losuj][3]-0.95"cylinder"1.10255070)
    rocks createObject(math.random(3930,3931), miner[losuj][1]+math.random(0.4,0.5), miner[losuj][2]+math.random(0.20.3), miner[losuj][3]-0.600math.random(0,90))
    blip createBlipAttachedTo(objective12)
    text createElement("text")
    setElementData(text"name""Surowiec")
    setElementPosition(textminer[losuj][1], miner[losuj][2], miner[losuj][3]+0.12)
    addEventHandler("onClientMarkerHit"objective, function(playermd)
    if not md or getElementType(player) ~= element_type then return end
    if player ~= localPlayer then return end
    if isPedInVehicle(playerthen outputChatBox("Nie mo?esz by? w poje?dzie!") return end
    local data setElementData(player"player:miner"true)
    if data then outputDebugString("Nadano elementdat? g?rnika dla u?ytkownika o nicku: "..getPlayerName(player).."."end
    setElementFrozen(playertrue)
    toggleAllControls(false)
    addEventHandler("onClientRender"rootpostep) 
    time getTickCount()
    setTimer(function()
    removeEventHandler("onClientRender"rootpostep)
    endtime_freeze1) 
    triggerServerEvent("animation"localPlayer)
    setTimer(function()
    setElementFrozen(playerfalse)
    toggleAllControls(true)
    setPedAnimation(playerdigging_animation)
    destroyElement(objective)
    destroyElement(blip)
    destroyElement(rocks)
    destroyElement(text)
    triggerServerEvent("end_animation"localPlayer)
    job_stage(localPlayer)
    wyplata(localPlayer)
    endtime_freeze1)
    end)
end

function wyplata()
        local kwota math.random(800,1500)
        local premium getElementData(localPlayer,"player:premium")
        local random math.random(1#nazwy)
        if premium then
        kwota kwota*1.3
        triggerServerEvent("givePlayerMoney"localPlayerkwota0)
        triggerEvent("create:noti",localPlayer,"Za wydobycie "..nazwy[random].."\notrzymujesz "..(kwota or "wyst?pi? b??d").." PLN.")
        else
        kwota kwota
        triggerServerEvent("givePlayerMoney"localPlayerkwota0)
        triggerEvent("create:noti",localPlayer,"Za wydobycie "..nazwy[random].."\notrzymujesz "..(kwota or "wyst?pi? b??d").." PLN.")
        end
end

function onresourcestop()
    if isEventHandlerAdded("onClientRender"rootpostepthen
    removeEventHandler("onClientRender"rootpostep)
    end
    setElementData(localPlayer"player:miner"false)
    setElementFrozen(localPlayerfalse)
    toggleControl("sprint"true)
    toggleControl("jump"true)
    toggleControl("crouch"true)
    toggleControl("next_weapon"true)
    toggleControl("previous_weapon"true)
    toggleControl("fire"true)
end
addEventHandler("onClientResourceStop"resourceRootonresourcestop)

dooroff createMarker (2538.19,-4264.39,319.16+0.5"arrow"1.5025519950)
local function hitmarker3(playermd)
    if not md or getElementType(player) ~= element_type then return end
    if player ~= localPlayer then return end
    if isPedInVehicle(playerthen return end
    setElementDimension(player0)
    setElementInterior(player0)
    if isElement(objective) and isElement(blip) and isElement(rocks) and isElement(textthen
    destroyElement(objective)
    destroyElement(blip)
    destroyElement(rocks)
    destroyElement(text)
    end
    if isEventHandlerAdded("onClientRender"rootpostepthen
    removeEventHandler("onClientRender"rootpostep)
    end
    toggleControl("sprint"truetoggleControl("jump"truetoggleControl("crouch"truetoggleControl("next_weapon"truetoggleControl("previous_weapon"true)
    triggerServerEvent("end_job"localPlayer)
    setElementData(localPlayer"player:miner"false)
    setElementPosition(player, -2004.04,-1501.25,94.59)
end
addEventHandler("onClientMarkerHit"dooroffhitmarker3)

local function hitmarker2(playermd)
    if not md or getElementType(player) ~= element_type then return end
    if player ~= localPlayer then return end
    outputChatBox("✔ Aby zako?czy? prac? "..name_job.." wci?nij klawisz #99FF00'"..button_job.."'"25500true)
end
addEventHandler("onClientMarkerHit"job_marker_cancelhitmarker2)


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
OlsiZRT11
Wysłany: 2018-04-13, 14:27


Gpla

Loading...






Wiek: 26
Na forum: 3853 dni
Posty: 84
Nick w MP: Loading...

Piwa: 174

Respekt: 55,3


Więcej informacji znajdziesz w Wikipedii MTA:

ToggleControl

+

Więcej informacji znajdziesz w Wikipedii MTA:

IsControlEnabled


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-13, 14:47


readreis







Wiek: 37
Na forum: 3908 dni
Posty: 62

Piwa: 4

Respekt: 50

Gpla, moglbys moze przerobic kod poniewaz gdy ja dodaje ta to nic nie zmienia tylko wyskakuje warning ;/ dotyczacy iscontrolenabled

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-13, 18:41


Gpla

Loading...






Wiek: 26
Na forum: 3853 dni
Posty: 84
Nick w MP: Loading...

Piwa: 174

Respekt: 55,3

Kod:


--client
local job_marker = createMarker(2540.31,-4275.68,319.15-0.9, "cylinder", 1, 255, 255, 0, 60)
local job_marker_cancel = createMarker(2537.29,-4274.15,319.15-0.9, "cylinder", 1, 255, 0, 0, 50)
local time_freeze = math.random(6000,9000)
local name_job = "wydobywania surowc?w mineralnych"
local button_job = "e"
local button_state = "down"
local digging_animation = "bat_4"
local sw, sh = guiGetScreenSize()


local rozpoczecie = createElement("text")
setElementData(rozpoczecie, "name", "Praca g?rnika\nZarobki: 7-15 PLN\nKonto premium x1.3")
setElementPosition(rozpoczecie,2540.31,-4275.68,319.15)

local anulowanie = createElement("text")
setElementData(anulowanie, "name", "Anulowanie pracy\nAby zako?czy?, wci?nij 'E'!")
setElementPosition(anulowanie, 2537.29,-4274.15,319.15+0.10)


local points = {
{2533.41,-4303.64,319.16},
{2527.03,-4302.24,319.16},
{2516.57,-4303.02,319.16},
{2507.36,-4303.87,319.16},
{2499.89,-4303.01,319.16},
{2503.08,-4312.34,319.16},
{2490.66,-4321.37,319.16},
{2481.48,-4329.13,319.16},
{2494.20,-4341.20,319.15},
{2502.44,-4339.79,319.15},
{2509.90,-4343.29,319.15},
{2532.28,-4337.73,319.16},
{2538.70,-4341.39,319.16},
{2543.33,-4331.29,319.16},
{2562.74,-4330.16,319.16},
{2564.67,-4317.71,319.16},
{2561.79,-4305.65,319.16},
{2542.92,-4296.89,319.15},
{2541.80,-4286.40,319.15},
{2532.97,-4283.27,319.15},
{2513.80,-4286.10,319.15},
{2535.32,-4306.41,319.16},
{2542.81,-4296.29,319.15},
{2545.23,-4328.79,319.78},
{2535.73,-4302.45,322.13},
{2518.81,-4303.76,322.21},
{2526.57,-4281.26,322.77},
{2496.01,-4303.22,322.28},
{2483.64,-4333.83,323.05},
{2492.24,-4356.38,322.82},
{2479.03,-4355.09,320.81},
{2454.80,-4353.29,328.25},
{2463.74,-4323.37,319.16},
{2479.40,-4306.67,322.23},
{2484.84,-4295.74,319.16},
}

local nazwy = {
"rudy ?elaza",
"w?gla brunatnego",
"w?gla kamiennego",
"rudy z?ota",
"rudy diamentu",
"rudy szmaragdu",
"rudy miedzi",
"soli kamiennej",
"granitu",
}

local objective
local draw
local draw = 0
local element_type = "player"

function isEventHandlerAdded( sEventName, pElementAttachedTo, func )
if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then
local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo )
if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
for i, v in ipairs( aAttachedFunctions ) do
if v == func then
return true
end
end
end
end
return false
end

local function postep()
local pasek = interpolateBetween(0, 0, 0, sw * 0.4297, 0, 0, (getTickCount()-time)/time_freeze, "InOutQuad")
dxDrawText("Post?p:", (sw * 0.2855) + 0.8, (sh * 0.2422) + 0.8, (sw * 0.4407) + 0.8, (sh * 0.2799) + 0.8, tocolor(0, 0, 0, 255), 3.00, "default-bold", "left", "top", false, false, false, true, false)
dxDrawText("Post?p:", sw * 0.2855, sh * 0.2422, sw * 0.4407, sh * 0.2799, tocolor(255, 255, 255, 255), 3.00, "default-bold", "left", "top", false, false, false, true, false)
dxDrawLine((sw * 0.2855) - 1, (sh * 0.3060) - 1, (sw * 0.2855) - 1, sh * 0.3659, tocolor(0, 0, 0, 200), 1, false)
dxDrawLine(sw * 0.7152, (sh * 0.3060) - 1, (sw * 0.2855) - 1, (sh * 0.3060) - 1, tocolor(0, 0, 0, 200), 1, false)
dxDrawLine((sw * 0.2855) - 1, sh * 0.3659, sw * 0.7152, sh * 0.3659, tocolor(0, 0, 0, 200), 1, false)
dxDrawLine(sw * 0.7152, sh * 0.3659, sw * 0.7152, (sh * 0.3060) - 1, tocolor(0, 0, 0, 200), 1, false)
dxDrawRectangle(sw * 0.2855, sh * 0.3060, sw * 0.4297, sh * 0.0600, tocolor(0, 0, 0, 170), false)
dxDrawRectangle(sw * 0.2855, sh * 0.3060, pasek, sh * 0.0600, tocolor(0, 178, 4, 255), false)
end

local function hitmarker(player, md)
if not md or getElementType(player) ~= element_type then return end
if player ~= localPlayer then return end
outputChatBox("Aby rozpocz?? prac? "..name_job.." wci?nij klawisz '"..button_job.."'.")
end
addEventHandler("onClientMarkerHit", job_marker, hitmarker)

local function startjob()
if not isElementWithinMarker(localPlayer, job_marker) then return end
if getElementData(localPlayer, "player:miner") == true then exports["noti"]:noti("* Posiadasz aktywn? prac?!", 255, 0, 0, true) return end
if getPedOccupiedVehicle(localPlayer) == true then exports["noti"]:noti("* Nie mo?esz by? w poje?dzie!", 255, 0, 0, false) return end
setElementData(localPlayer, "player:miner", true)
outputChatBox("Rozpocz??e?(a?) prac? "..name_job..", id? wydoby? surowiec zaznaczony blipem 'C' na minimapie.")
toggleControl("sprint", false) toggleControl("jump", false) toggleControl("crouch", false) toggleControl("next_weapon", false) toggleControl("previous_weapon", false) toggleControl("fire", false)
triggerServerEvent("kilof", localPlayer)
job_stage(localPlayer)
end
bindKey(button_job, button_state, startjob)

local function canceljob()
if not isElementWithinMarker(localPlayer, job_marker_cancel) then return end
if getElementData(localPlayer, "player:miner") == false then outputChatBox("Nie posiadasz aktywnej pracy!") return end
if getPedOccupiedVehicle(localPlayer) == true then outputChatBox("Nie mo?esz by? w poje?dzie!") return end
outputChatBox("Zako?czy?e?(a?) prac? "..name_job..".")
toggleControl("sprint", true) toggleControl("jump", true) toggleControl("crouch", true) toggleControl("next_weapon", true) toggleControl("previous_weapon", true)
if isElement(objective) and isElement(blip) and isElement(rocks) and isElement(text) then
destroyElement(objective)
destroyElement(blip)
destroyElement(rocks)
destroyElement(text)
end
if isEventHandlerAdded("onClientRender", root, postep) then
removeEventHandler("onClientRender", root, postep)
end
triggerServerEvent("end_job", localPlayer)
setElementData(localPlayer, "player:miner", false)
end
bindKey(button_job, button_state, canceljob)

function job_stage(player, md)
if (objective) and isElement(objective) then
destroyElement(objective)
destroyElement(blip)
destroyElement(rocks)
objective = nil
end
toggleControl("sprint", false) toggleControl("jump", false) toggleControl("crouch", false) toggleControl("next_weapon", false) toggleControl("previous_weapon", false) toggleControl("fire", false) toggleControl ("aim_weapon", false )
local losuj = math.random(2, #points)
local miner = points
objective = createMarker(miner[losuj][1], miner[losuj][2], miner[losuj][3]-0.95, "cylinder", 1.1, 0, 255, 0, 70)
rocks = createObject(math.random(3930,3931), miner[losuj][1]+math.random(0.4,0.5), miner[losuj][2]+math.random(0.2, 0.3), miner[losuj][3]-0.6, 0, 0, math.random(0,90))
blip = createBlipAttachedTo(objective, 12)
text = createElement("text")
setElementData(text, "name", "Surowiec")
setElementPosition(text, miner[losuj][1], miner[losuj][2], miner[losuj][3]+0.12)
addEventHandler("onClientMarkerHit", objective, function(player, md)
if not md or getElementType(player) ~= element_type then return end
if player ~= localPlayer then return end
if isPedInVehicle(player) then outputChatBox("Nie mo?esz by? w poje?dzie!") return end
local data = setElementData(player, "player:miner", true)
if data then outputDebugString("Nadano elementdat? g?rnika dla u?ytkownika o nicku: "..getPlayerName(player)..".") end
setElementFrozen(player, true)
toggleAllControls(false)
addEventHandler("onClientRender", root, postep)
time = getTickCount()
setTimer(function()
removeEventHandler("onClientRender", root, postep)
end, time_freeze, 1)
triggerServerEvent("animation", localPlayer)
setTimer(function()
setElementFrozen(player, false)
toggleAllControls(true)
setPedAnimation(player, digging_animation)
destroyElement(objective)
destroyElement(blip)
destroyElement(rocks)
destroyElement(text)
triggerServerEvent("end_animation", localPlayer)
job_stage(localPlayer)
wyplata(localPlayer)
end, time_freeze, 1)
end)
end

function wyplata()
local kwota = math.random(800,1500)
local premium = getElementData(localPlayer,"player:premium")
local random = math.random(1, #nazwy)
if premium then
kwota = kwota*1.3
triggerServerEvent("givePlayerMoney", localPlayer, kwota, 0)
triggerEvent("create:noti",localPlayer,"Za wydobycie "..nazwy[random].."\notrzymujesz "..(kwota or "wyst?pi? b??d").." PLN.")
else
kwota = kwota
triggerServerEvent("givePlayerMoney", localPlayer, kwota, 0)
triggerEvent("create:noti",localPlayer,"Za wydobycie "..nazwy[random].."\notrzymujesz "..(kwota or "wyst?pi? b??d").." PLN.")
end
end

function onresourcestop()
if isEventHandlerAdded("onClientRender", root, postep) then
removeEventHandler("onClientRender", root, postep)
end
setElementData(localPlayer, "player:miner", false)
setElementFrozen(localPlayer, false)
toggleControl("sprint", true)
toggleControl("jump", true)
toggleControl("crouch", true)
toggleControl("next_weapon", true)
toggleControl("previous_weapon", true)
toggleControl("fire", true)
end
addEventHandler("onClientResourceStop", resourceRoot, onresourcestop)

dooroff = createMarker (2538.19,-4264.39,319.16+0.5, "arrow", 1.5, 0, 255, 199, 50)
local function hitmarker3(player, md)
if not md or getElementType(player) ~= element_type then return end
if player ~= localPlayer then return end
if isPedInVehicle(player) then return end
setElementDimension(player, 0)
setElementInterior(player, 0)
if isElement(objective) and isElement(blip) and isElement(rocks) and isElement(text) then
destroyElement(objective)
destroyElement(blip)
destroyElement(rocks)
destroyElement(text)
end
if isEventHandlerAdded("onClientRender", root, postep) then
removeEventHandler("onClientRender", root, postep)
end
toggleControl("sprint", true) toggleControl("jump", true) toggleControl("crouch", true) toggleControl("next_weapon", true) toggleControl("previous_weapon", true) toggleControl ("aim_weapon", true )
triggerServerEvent("end_job", localPlayer)
setElementData(localPlayer, "player:miner", false)
setElementPosition(player, -2004.04,-1501.25,94.59)
end
addEventHandler("onClientMarkerHit", dooroff, hitmarker3)

local function hitmarker2(player, md)
if not md or getElementType(player) ~= element_type then return end
if player ~= localPlayer then return end
outputChatBox("✔ Aby zako?czy? prac? "..name_job.." wci?nij klawisz #99FF00'"..button_job.."'", 255, 0, 0, true)
end
addEventHandler("onClientMarkerHit", job_marker_cancel, hitmarker2)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-13, 19:35


readreis







Wiek: 37
Na forum: 3908 dni
Posty: 62

Piwa: 4

Respekt: 50

Gpla, To nic nie pomoglo

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-13, 21:57


Cholewka

Zakorzeniony w LUA






Wiek: 22
Na forum: 3583 dni
Posty: 190

Piwa: 707

Respekt: 155,3
Respekt: 155,3Respekt: 155,3

Cytat:

Witam ma taki problem i? gracze moga bi? kilofem podczas pracy wydaje mi sie, ?e w skrypcie wszystko sie zgadza ale moge sie mylic.

Nie rozumiem pytania, chcesz, ?eby gracze bili kilofem czy ?eby nie bili kilofami?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-14, 00:14


readreis







Wiek: 37
Na forum: 3908 dni
Posty: 62

Piwa: 4

Respekt: 50

Cholewka, nie bili

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-14, 14:05


Ciastuuś

Truck soon...






Wiek: 26
Na forum: 3071 dni
Posty: 799
Nick w MP: Ciastuuś

Piwa: 4297

Respekt: 640
Respekt: 640Respekt: 640

U?yj,


Więcej informacji znajdziesz w Wikipedii MTA:

toggleControl


A, tutaj sprawdzisz list? kontroli,


Więcej informacji znajdziesz w Wikipedii MTA:

Control_names


Podpis
Truck soon...
Postaw piwo autorowi tego posta
 

 
Tagi: praca :: gornik
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