addEvent("givePlayerRepka", true)
addEventHandler("givePlayerRepka", root, function(value2)
-- nie zalogowana osoba a fuj
if not getElementData(source,"player:logged") then return end
local rnd={math.random(1,30),math.random(1,2)}
if rnd[1] == 1 or rnd[1] == 15 or rnd[1] == 26 then
local rep=getElementData(source,"player:reputation") or 0
local xd=rep+rnd[2]
setElementData(source,"player:reputation",xd)
triggerClientEvent(source, "reputation:show", resourceRoot, rnd)
end
end)
Dodaj to tam gdzie by?o givePlayerMoney
a to dodaj do prac
triggerServerEvent("givePlayerRepka",root)
Podpis
Dodaj na Steam: Kod: 1093365219
Discord: NoOne#3644
addEvent("givePlayerRepka", true)
addEventHandler("givePlayerRepka", root, function(value2)
-- nie zalogowana osoba a fuj
if not getElementData(source,"player:logged") then return end
local rnd={math.random(1,30),math.random(1,2)}
if rnd[1] == 1 or rnd[1] == 15 or rnd[1] == 26 then
local rep=getElementData(source,"player:reputation") or 0
local xd=rep+rnd[2]
setElementData(source,"player:reputation",xd)
triggerClientEvent(source, "reputation:show", resourceRoot, rnd)
end
end)
Pytanie :
- Czy u?ywasz tylko tego triggera do przydzielania wyp?aty/reputacji itp (wyplataPraca) , je?eli nie to podaj reszte.
Nie wiem dok?adnie co chcesz osi?gn?? bo je?eli chcesz aby z ka?dej pracy got?wka dochodzi?a na konto , to mo?esz z edytowa? "givePlayerMoney" tak aby dodawa? tylko reputacje zamiast reputacji i pieni?dzy.
Chodzi mi o to ze jak mia?em trigger givePlayerMoney i ten kod na reputacje up to all dzia?a?o a jak zmienia?em to na trigger "WyplataPraca"to juz nie dostaje tej reputacji i chodzi mi tu o to zeby po zmianie triggera tez dodawalo reputacje.
Przyk?adowa praca mo?e co? pomo?e.
local m1 = createMarker(1799.74,-1934.21,13.49-0.9, "cylinder",1,0,255,0)
vehs = {}
function removePreviousVehicles(plr)
for i,v in ipairs(getElementsByType("vehicle", resourceRoot)) do
local sby = getElementData(v, "zrespilGracz")
if sby and sby == plr and getPedOccupiedVehicle(plr) ~= v then
destroyElement(v)
end
end
end
addEventHandler("onMarkerHit", m1, function(el, md)
if getElementData(el, "zrespilGracz") then
outputChatBox("praca w trakcie poprawek", el)
return
end
if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(el) then return end
local x,y,z = getElementPosition(el)
local bus = createVehicle(431, 1795.26,-1930.91,13.49,359.5,360.0,0.5)
setElementData(bus, "zrespilGracz", el)
setElementData(bus, "vehicle:fuel", 100)
setElementData(bus, "vehicle:mileage", 69000)
setElementData(bus, "vehicle:desc", "Praca Dorywcza\nKierowca Autobusu\nCel:Gie?da")
warpPedIntoVehicle(el, bus)
removePreviousVehicles(el)
triggerClientEvent(el, "STARTJobBus", resourceRoot, bus)
vehs[el] = bus
end)
addEvent("STOPJobBus", true)
addEventHandler("STOPJobBus", resourceRoot, function()
local pojazd = getPedOccupiedVehicle(localPlayer)
if pojazd then
destroyElement(pojazd)
end
end)
addEvent("destroyVeh", true)
addEventHandler("destroyVeh", getRootElement(),
function()
if vehs[source] then
if isElement(vehs[source]) then destroyElement(vehs[source]) end
end
end)
addEvent("STOPJobBus", true)
addEventHandler("STOPJobBus", resourceRoot, function()
local pojazd = getPedOccupiedVehicle(localPlayer)
if pojazd then
destroyElement(pojazd)
end
end)
addEvent("destroyVeh", true)
addEventHandler("destroyVeh", getRootElement(),
function()
if vehs[source] then
if isElement(vehs[source]) then destroyElement(vehs[source]) end
end
end)
addEvent("onPlayerQuit", true)
addEventHandler ( "onPlayerQuit", getRootElement(), function()
if vehs[source] then
if isElement(vehs[source]) then destroyElement(vehs[source]) end
end
end)
local t=createElement("text")
setElementData(t, "scale", 1.2)
setElementData(t,"name","Praca Kierowcy Autobusu\n20PLN za przystanek!")
setElementPosition(t, 1799.74,-1934.21,13.49)
local districtsBus = {
{1817.91,-1917.31,13.38},
{1916.32,-1936.04,13.38},
{1985.46,-1936.26,13.38},
{2085.96,-1915.64,13.38},
{2085.63,-1852.60,13.38},
{2085.70,-1806.89,13.38},
{2114.49,-1693.73,13.38},
{2116.98,-1581.85,25.96},
{2116.56,-1442.89,23.83},
{2086.14,-1380.24,23.83},
{2076.03,-1281.49,23.83},
{2075.67,-1172.02,23.66},
{2019.02,-1131.67,24.79},
{1927.82,-1131.63,25.01},
{1862.59,-1157.71,23.69},
{1795.70,-1170.01,23.65},
{1607.47,-1156.67,23.91},
{1514.15,-1156.63,23.91},
{1450.54,-1265.07,13.38},
{1450.02,-1418.88,13.38},
{1425.29,-1573.70,13.36},
{1425.43,-1671.88,13.38},
{1429.87,-1736.51,13.38},
{1629.79,-1736.56,13.38},
{1781.05,-1736.39,13.38},
{1817.39,-1788.47,13.38},
{1817.38,-1870.58,13.41},
}
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)
exports.notification:showBox ("info","Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
--exports["rpg_noti"]:createNotification(el,"Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
outputChatBox("Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
else
showMarker()
playSoundFrontEnd(12)
triggerServerEvent("WyplataPraca",root, 10)
triggerServerEvent("givePlayerRepka",root)
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,128,255,0)
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)
exports.notification:showBox ("info","Rozpocz??e? Prace Kierowyc Autobusu.Zarobki 20 PLN Za Przystanek!")
--exports["rpg_noti"]:createNotification(el,"Rozpocz??e? Prace Kierowyc Autobusu.Zarobki 10 PLN Za Przystanek!")
outputChatBox("Rozpocz??e? Prace Kierowyc Autobusu.Zarobki 20 PLN Za Przystanek!")
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()
exports.notification:showBox ("info","Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
--exports["rpg_noti"]:createNotification(el,"Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
outputChatBox("Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
end
end
end)
addEvent("givePlayerMoney", true)
addEventHandler("givePlayerMoney", root, function(value2)
-- nie zalogowana osoba a fuj
if not getElementData(source,"player:logged") then return end
local rnd={math.random(1,30),math.random(1,2)}
if rnd[1] == 1 or rnd[1] == 15 or rnd[1] == 26 then
local rep=getElementData(source,"player:reputation") or 0
local xd=rep+rnd[2]
setElementData(source,"player:reputation",xd)
triggerClientEvent(source, "reputation:show", resourceRoot, rnd)
end
end)
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