}
for i,v in pairs(positionVehicles) do
local veh=createVehicle(v[2], v[5], v[6], v[7], v[8], v[9], v[10], v[11])
setElementData(veh,'vehicle:desc','Pojazd: '..v[1]..'\nCena: '..v[4]..' PLN\nPrzebieg: '..v[3]..' km\nAby Kupi? pojazd wsi?dz na F i wpisz /kuppojazd')
setVehicleOverrideLights(veh, 1)
setElementFrozen(veh,true)
setVehicleColor(veh, 22,0,0)
--setVehiclePlateText(veh,Kupmnie)
setVehicleDamageProof(veh, true)
setElementData(veh,'vehicle.selling', true)
veh:setData('vehsell:info', {
['cost']=(v[4]),
['model']=v[2],
['mileage']=v[3],
['selling']=v[12]
}, false)
end
addEventHandler('onVehicleEnter', resourceRoot, function(plr, seat, jacked)
if seat~=0 then return end
if source:getData('vehsell:info') and source:getData('vehsell:info').selling==1 then
plr:outputChat('* Pojazd nie jest dost?pny w sprzeda?y.', 255, 0, 0)
return
end
local data=source:getData('vehsell:info')
if not data then return end
plr:outputChat(' Aby zakupi? ten pojazd wpisz /kuppojazd')
end)
addEventHandler('onVehicleExit', resourceRoot, function(plr, seat, jacked)
if seat~=0 then return end
local data=plr:getData('vehsell:info')
if not data then return end
plr:removeData('vehsell:info')
end)
addCommandHandler('kuppojazd', function(plr, cmd)
local data=plr:getData('vehsell:info')
if not data then return end
if getPlayerMoney(plr) < data.cost then
triggerClientEvent(plr,"addNotification",root,"Nie posiadasz wystarczajacej kwoty pieni?dzy!","error")
return
end
local vehicle=plr:getOccupiedVehicle()
if vehicle then
removePedFromVehicle(vehicle)
end
local cost=data.cost
local model=data.model
local mileage=data.mileage
local uid=getElementData(plr,'player:uid') or 0
takePlayerMoney(plr, cost)
if mileage <= 2000 then
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_vehicles (model,ownedPlayer,mileage,registered,parking) VALUES (?,?,?,?,1)", model, getElementData(plr,"player:uid"),mileage,"false")
else
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_vehicles (model,ownedPlayer,mileage,registered,parking) VALUES (?,?,?,?,1)", model, getElementData(plr,"player:uid"),mileage,"true")
end
triggerClientEvent(plr,"addNotification",root,string.format("Zakupi?e? sw?j pojazd "..getVehicleNameFromModel(model)..", znajdziesz go w przechowywalni."),"info")
end)
[ Dodano: 2018-06-28, 19:31 ]
a ten drugi to
createBlip(-1953.37, 269.16, 35.47, 55,2,0,0,0,0,0,275) -- Salon pojazd?w rekreacyjnych Doherty | San Fierro. - |SAPD|Bone
createBlip(-512.89, 324.55, 2.73, 43,2,0,0,0,0,0,275) -- Salon pojazd?w motorniczych The Panopticon | Red County. - |SAPD|Bone
createBlip(266.14, -277.08, 1.58, 55,2,0,0,0,0,0,275) -- Cygan Blue Berry | Tierra Robada. - |SAPD|Bone
createBlip(-1661.34, 1212.81, 13.67, 55,2,0,0,0,0,0,275) -- Salon pojazd?w sportowych Downtown | San Fierro. - |SAPD|Bone
for i,v in pairs(positionVehicles) do
local veh=createVehicle(v[2], v[5], v[6], v[7], v[8], v[9], v[10], v[11])
setElementData(veh,'vehicle:desc','Pojazd: '..v[1]..'\nCena: '..v[4]..' PLN\nPrzebieg: '..v[3]..' km\nAby Kupi? pojazd wsi?dz na F i wpisz /kuppojazd')
setVehicleOverrideLights(veh, 1)
setElementFrozen(veh,true)
setVehicleColor(veh,150,150,150,150,150,150)
setVehicleDamageProof(veh, true)
setElementData(veh,'recznySalonData', true)
veh:setData('vehsell:info', {
['cost']=(v[4]),
['model']=v[2],
['mileage']=v[3],
['selling']=v[12],
['engine']=v[18]
}, false)
end
addEventHandler('onVehicleEnter', resourceRoot, function(plr, seat, jacked)
if seat~=0 then return end
if source:getData('vehsell:info') and source:getData('vehsell:info').selling==1 then
plr:outputChat('* Pojazd nie jest dost?pny w sprzeda?y.', 255, 0, 0)
return
end
local data=source:getData('vehsell:info')
if not data then return end
addEventHandler('onVehicleExit', resourceRoot, function(plr, seat, jacked)
if seat~=0 then return end
local data=plr:getData('vehsell:info')
if not data then return end
plr:removeData('vehsell:info')
end)
addCommandHandler('kuppojazd', function(plr, cmd)
local data=plr:getData('vehsell:info')
if not data then return end
if getPlayerMoney(plr) < data.cost then
plr:outputChat('* Nie posiadasz wystarczaj?cej kwoty pieni?dzy !')
return
end
local vehicle=plr:getOccupiedVehicle()
if vehicle then
removePedFromVehicle(vehicle)
end
local cost=data.cost
local model=data.model
local mileage=data.mileage
local uid=getElementData(plr,'player:uid') or 0
takePlayerMoney(plr, cost)
if mileage <= 100 then
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_vehicles (model,ownedPlayer,mileage,registered,parking) VALUES (?,?,?,?,1)", model, getElementData(plr,"player:uid"),mileage,"false")
else
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_vehicles (model,ownedPlayer,mileage,registered,parking) VALUES (?,?,?,?,1)", model, getElementData(plr,"player:uid"),mileage,"true")
end
--triggerClientEvent(plr,"addNotification",root,string.format("Zakupi?e? sw?j pojazd "..getVehicleNameFromModel(model)..", znajdziesz go w przechowywalni."),"info")
plr:outputChat('* Zakupi?e?(a?) sw?j pojazd '..getVehicleNameFromModel(model)..', znajdziesz go w przechowywalni.')
end)
You have no right to use this code without my permission.
]]
-- Functions
addEvent("interaction:onSelected", true)
addEventHandler("interaction:onSelected", resourceRoot, function(player, veh, interaction)
if not veh or not interaction then return end
if veh:getData('vehicle.selling') and veh:getData('vehicle.selling')==true then
--player:outputChat('')
return
end
if interaction==1 then
if veh:getOverrideLights()~=2 then
veh:setOverrideLights(2)
player:outputChat('* W??czy?e?(a?) swiatla.')
else
veh:setOverrideLights(1)
player:outputChat('* Wy??czy?e?(a?) swiatla.')
end
elseif interaction==2 then
local state=veh:getEngineState()
if veh:getData('vehicle:mileage') and veh:getData('vehicle:fuel') then
if veh:getData('vehicle:mileage')>1000000 then
player:outputChat('* Nie mozna odpalic silnik, zbyt duzy przebieg...')
return
end
if veh:getData('vehicle:fuel')<1 then
player:outputChat('* Nie mozna odpalic silnika, malo paliwa w baku...')
return
end
if state then
player:outputChat('* Zgasi?e?(a?) silnik.')
else
player:outputChat('* Uruchomi?e?(a?) silnik.')
end
Timer(function()
veh:setEngineState(not state)
end, 800, 1)
else
if state then
player:outputChat('* Zgasi?e?(a?) silnik.')
else
player:outputChat('* Uruchomi?e?(a?) silnik.')
end
Timer(function()
veh:setEngineState(not state)
end, 800, 1)
end
elseif interaction==3 then
if veh:getData('vehicle:spawn') then
veh:setVelocity(0.0, 0.0, 0.0)
if veh:isFrozen() then
if getElementData(zmienna_pojazdu, "vehsell:info") == 1 then return end
Timer(function()
veh:setFrozen(false)
end, 300, 1)
player:outputChat('* Spu?ci?e?(a?) r?czny')
else
Timer(function()
veh:setFrozen(true)
end, 300, 1)
player:outputChat('* Zaci?gn??e?(a?) r?czny.')
end
else
veh:setVelocity(0.0, 0.0, 0.0)
if veh:isFrozen() then
if getElementData(zmienna_pojazdu, "vehsell:info") == 1 then return end
Timer(function()
veh:setFrozen(false)
end, 300, 1)
player:outputChat('* Spu?ci?e?(a?) r?czny')
else
Timer(function()
veh:setFrozen(true)
end, 300, 1)
player:outputChat('* Zaci?gn??e?(a?) r?czny.')
end
end
elseif interaction==4 then
if veh:getData('vehicle:spawn') then
--[[
zamykanie pojazdu dla osob trzecich
]]
if veh:isLocked() then
player:outputChat('* W budowie')
else
player:outputChat('* W budowie')
end
end
end
end)
Dobrze umie?ci?em ten kod czy nie? Bo nie dzia?a..
bambuseeeek, pierwszy argument getElementData to zmienna pojazdu...
Bo?e... - jak mo?esz skopiowa? t? linijk? bez ?adnej poprawki? Przecie? w kodzie Twoj? zmienn? pojazdu jest veh, a nie jakie? ?adne zmienna_pojazdu
bambuseeeek, pierwszy argument getElementData to zmienna pojazdu...
Bo?e... - jak mo?esz skopiowa? t? linijk? bez ?adnej poprawki? Przecie? w kodzie Twoj? zmienn? pojazdu jest veh, a nie jakie? ?adne zmienna_pojazdu
Ucze si?, tak? Nie dzia?a dalej wi?c prosz? o pomoc....
! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
addEvent("r?cznysalon",true)
addEventHandler("r?cznysalon",root,function()
local v = getPedOccupiedVehicle(source)
if v then
if not isVehicleOnGround(v) then return end
if getElementData(v,"komis:veh") then triggerClientEvent(source, "onClientAddNotification", source, "Interakcja nie dzia?a na pojazd z salonu") return end
if isElementFrozen(v) then
setElementFrozen(v,false)
else
setElementFrozen(v,true)
end
end
end)
client dodajesz ten kod gdzie otwiera si? interakcja z wyborami czy jako? tak
if getElementData(veh,"komis:veh") then return end
addEvent("r?cznysalon",true)
addEventHandler("r?cznysalon",root,function()
local v = getPedOccupiedVehicle(source)
if v then
if not isVehicleOnGround(v) then return end
if getElementData(v,"komis:veh") then triggerClientEvent(source, "onClientAddNotification", source, "Interakcja nie dzia?a na pojazd z salonu") return end
if isElementFrozen(v) then
setElementFrozen(v,false)
else
setElementFrozen(v,true)
end
end
end)
client dodajesz ten kod gdzie otwiera si? interakcja z wyborami czy jako? tak
if getElementData(veh,"komis:veh") then return end
addEvent("r?cznysalon",true)
addEventHandler("r?cznysalon",root,function()
local v = getPedOccupiedVehicle(source)
if v then
if not isVehicleOnGround(v) then return end
if getElementData(v,"vehicle.selling") then exports["1"]:outputNotificationBox (source, "#cc0000Interakcja nie dzia?a na pojazdach wystawowych!") return end
if isElementFrozen(v) then
setElementFrozen(v,false)
else
setElementFrozen(v,true)
end
end
end)
Mia?em ju? co? takiego w interakcji, dalej nie dzia?a. Nie wiem co robi?.
addEvent("r?cznysalon",true)
addEventHandler("r?cznysalon",root,function()
local v = getPedOccupiedVehicle(source)
if v then
if not isVehicleOnGround(v) then return end
if getElementData(v,"komis:veh") then triggerClientEvent(source, "onClientAddNotification", source, "Interakcja nie dzia?a na pojazd z salonu") return end
if isElementFrozen(v) then
setElementFrozen(v,false)
else
setElementFrozen(v,true)
end
end
end)
client dodajesz ten kod gdzie otwiera si? interakcja z wyborami czy jako? tak
if getElementData(veh,"komis:veh") then return end
addEvent("r?cznysalon",true)
addEventHandler("r?cznysalon",root,function()
local v = getPedOccupiedVehicle(source)
if v then
if not isVehicleOnGround(v) then return end
if getElementData(v,"vehicle.selling") then exports["1"]:outputNotificationBox (source, "#cc0000Interakcja nie dzia?a na pojazdach wystawowych!") return end
if isElementFrozen(v) then
setElementFrozen(v,false)
else
setElementFrozen(v,true)
end
end
end)
Mia?em ju? co? takiego w interakcji, dalej nie dzia?a. Nie wiem co robi?.
I dobrze masz. Po stronie clienta teraz musisz da? to tam gdzie si? otwiera interakcja w przypadku u mnie to tak wygl?da
function onPanelInterkcja()
local veh = getPedOccupiedVehicle(localPlayer)
if veh then
if rowery[getVehicleName(veh)] then return end
if getElementData(veh,"komis:veh") then return end
if getVehicleController(veh) == localPlayer then
if panelWyboruOpcji == false then
addEventHandler("onClientRender",root,WyborySPW)
tick = getTickCount()
wybrana_opcja=1
panelWyboruOpcji = true
end
end
end
end
TO jest przyk?ad
if getElementData(veh,"komis:veh") then return end
To wklejasz tam gdzie ma otwieraj?cy si? panel musi jako? nazywa? si? ten kod.
Jak nie to podaj ca?? strone clienta i ci zrobie.
Pami?taj ?eby? zmieni? element date i argument bo stawiam ?e masz inny
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