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

Wysłany: 2019-06-27, 20:56


kerfyn

Hyp3R






Wiek: 25
Na forum: 2739 dni
Posty: 121
Nick w MP: Hyp3R

Piwa: 2

Respekt: 50

Witam przychodz? z pro?b? ?eby mi kto? pom?gl mianowicie Chc? zrobic Przecinki w salonie patrzy?em Jak to si? robi itd Ale co? mi nie dzia?a. mam salon z ogrpg. Wczesniej pisa?em o Hud z przecinkiem ale z tamtym sobie poradzi?em Wi?c teraz z tym mam problem I nie mog? go rozwi?za? sam za pomoc Piwo


[code]
createBlip(1535.30,1761,11.29,5)
createBlip(761.53,1980.96,5.02,55)
createBlip(1167.32,2094.24,10.51,55)

function przecinkimagic(amount)
local formatted = amount
while true do
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
if (k==0) then
break
end
end
return formatted
end

--local limit_aut = 5


local positionVehicles = {
-- nazwa, model, przebieg, cena, x,y,z,rx,ry,rz, sprzeda?
--------------------------------------------------------------------------------------
----// Salon Sportowy San Fierro
--------------------------------------------------------------------------------------
{'Slamvan', 535, {0,100}, {40000000,40000000}, -1661.35,1212.67,6.90,359.5,0.0,288.5},
{'Zr-350', 477, {0,100}, {50000000,50000000}, -1648.26,1207.11,13.29,359.4,0.0,39.3},
{'Sandking', 495, {0,100}, {70000000,70000000}, -1664.22,1222.61,13.30,359.5,359.9,205.4},
{'Elegy', 562, {0,100}, {60000000,60000000}, -1671.90,1205.37,13.30,359.5,360.0,272.8},
{'Uranus', 558, {0,100}, {70000000,70000000}, -1675.24,1206.53,20.81,359.5,0.0,269.6},
{'Infernus', 411, {0,0}, {99999999,99999999}, -1649.45,1206.88,20.77,359.4,359.9,61.0},
{'Jester', 559, {0,100}, {80000000,80000000}, -1662.36,1219.65,20.76,359.5,360.0,215.0},
{'Sultan', 560, {0,100}, {90000000,90000000}, -1662.03,1205.75,20.80,359.5,360.0,287.0},
----------
{'Burrito', 482, {0,100}, {11000000,11000000}, 1168.78,2077.39,16.13,360.0,0.0,130.0},
{'Comet', 480, {0,100}, {10000000,10000000}, 1120.33,2077.56,16.13,360.0,0.0,226.0},
{'Infernus', 411, {0,100}, {25000000,25000000}, 1125.18,2107.78,16.14,360.0,0.0,225.4}, -- VIP
{'Hermes', 474, {0,100}, {13000000,13000000}, 1152.09,2095.44,16.14,359.9,359.9,135.0},
--------------------------------------------------------------------------------------
----// Cygan
--------------------------------------------------------------------------------------
{'Perennial', 404, {60000,70000}, {150000,150000}, 761.53,1980.96,5.02,360.0,0.0,240.3},
{'Walton', 478, {60000,70000}, {250000,250000}, 788.82,1981.67,5.02+0.4,360.0,0.0,113.8},
{'Moonbeam', 418, {60000,70000}, {280000,280000}, 776.47,2013.81,5.57+0.5,358.1,1.1,221.3},
--------------------------------------------------------------------------------------
----// Moto
--------------------------------------------------------------------------------------
{'BF-400', 581, {0,100}, {5000000,5000000}, 1163.13,2070,10.41,359.3,0.0,152.6},
{'FCR-900', 521, {0,100}, {8000000,8000000}, 1163.13-5,2070,10.41,359.3,0.0,152.6},
{'Sanchez', 468, {0,100}, {3000000,3000000}, 1163.13-10,2070,10.41,359.3,0.0,152.6},
--------------------------------------------------------------------------------------
----// Lotnisko
--------------------------------------------------------------------------------------
{'Dodo', 593, {0,100}, {9000000,9000000}, 1535.30,1761,11.29,359.7,360.0,101.2},
{'Sparrow', 469, {0,100}, {15000000,15000000}, 1535.30,1780,11.29,359.7,360.0,101.2},
{'Stuntplane', 513, {0,100}, {25000000,25000000}, 1535.30,1800,11.29,359.7,360.0,101.2},
}
for i,v in pairs(positionVehicles) do
local veh=createVehicle(v[2], v[5], v[6], v[7]+0.3, v[8], v[9], v[10], v[11])
local cena; if type(v[4]) == "table" then cena=(math.random(v[4][1],v[4][2])) else cena = v[4] end
local przebieg; if type(v[3]) == "table" then przebieg=(math.random(v[3][1],v[3][2])) else przebieg = v[3] end
setElementData(veh,'opis','Pojazd: '..v[1]..'\n\nCena: '..przecinkimagic (v[4])..' PLN\nPrzebieg: '..przebieg..' km \nChcesz zakupi? pojazd '..v[1]..' \nwsi?d? do niego i wpisz /kuppojazd')
setVehicleOverrideLights(veh, 1)
setElementFrozen(veh,true)
setVehicleColor(veh, math.random(0,255),math.random(0,255),math.random(0,255))
--setVehicleColor( veh, 0, 0, 19, 255,255,255, 255,255,255 ,255,255,255 )
--setVehiclePlateText(veh,Kupmnie)
setElementData(veh,"vehicle:mileage",przebieg)
setVehicleDamageProof(veh, true)
setElementData(veh,'vehicle.selling', true)
veh:setData('vehsell:info', {
['cost']=cena,
['model']=v[2],
['mileage']=przebieg,
['selling']=v[12],
['id']=i,
}, false)
addEventHandler('onVehicleRespawn',veh,function()
local cena
local cena; if type(v[4]) == "table" then cena=(math.random(v[4][1],v[4][2])) else cena = v[4] end
local przebieg; if type(v[3]) == "table" then przebieg=(math.random(v[3][1],v[3][2])) else przebieg = v[3] end
setElementData(veh,'opis','Pojazd: '..v[1]..'\n\nCena: '..przecinkimagic (v[4])..' PLN\nPrzebieg: '..przebieg..' km \nChcesz zakupi? pojazd '..v[1]..' wsi?d? do niego i wpisz /kuppojazd')
setVehicleOverrideLights(veh, 1)
setElementFrozen(veh,true)
setVehicleColor(veh, math.random(0,255),math.random(0,255),math.random(0,255))
--setVehicleColor( veh, 0, 0, 19, 255,255,255, 255,255,255 ,255,255,255 )
--setVehiclePlateText(veh,Kupmnie)
setVehicleDamageProof(veh, true)
setElementData(veh,'vehicle.selling', true)
setElementData(veh,"vehicle:mileage",przebieg)
veh:setData('vehsell:info', {
['cost']=cena,
['model']=v[2],
['mileage']=przebieg,
['selling']=v[12],
['id']=i,
}, false)
end)
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:setData('vehsell:info', {
['cost']=data.cost,
['model']=data.model,
['mileage']=data.mileage,
}, false)

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 pojazdy=plr:getData('player:vehicles')
local limit=plr:getData('player:vehlimit')
if tonumber(pojazdy) <= tonumber(limit) then
local data=plr:getData('vehsell:info')
if not data then return end
local kasa = exports["ogrpg-db"]:dbGet("SELECT bank_money FROM ogrpg_users WHERE id =?",tonumber(getElementData(plr,"player:uid")))
if tonumber(kasa[1].bank_money) < data.cost then
plr:outputChat('Nie posiadasz wystarczajacej kwoty pieni?dzy w BANKU!!')
return
end

local vehicle=plr:getOccupiedVehicle()
respawnVehicle(vehicle)
if vehicle then
removePedFromVehicle(plr)
end

local cost=data.cost
local model=data.model
local mileage=data.mileage
local wariant=math.random(1,2)
local uid=getElementData(plr,'player:uid') or 0
exports["YNE-KasaBank"]:takePlayerBankMoney(plr, cost)
if mileage <= 10000 then
--[[
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_vehicles (model,ownedPlayer,mileage,registered,parking,firstowner) VALUES (?,?,?,?,1,?)", model, getElementData(plr,"player:uid"),mileage,"false",getElementData(plr,"player:uid"))
else
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_vehicles (model,ownedPlayer,mileage,registered,parking,firstowner) VALUES (?,?,?,?,1,?)", model, getElementData(plr,"player:uid"),mileage,"true",getElementData(plr,"player:uid"))
end
triggerClientEvent(plr,"addNotification",root,string.format("Zakupi?e? sw?j pojazd "..getVehicleNameFromModel(model)..", znajdziesz go w przechowywalni."),"info")
plr:outputChat('Zakupi?e? sw?j pojazd znajdziesz go w przechowywalni!')
]]--
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_vehicles (wariant,model,ownedPlayer,mileage,registered,parking,firstowner) VALUES (?,?,?,?,?,1,?)", wariant, model, getElementData(plr,"player:uid"),mileage,"false",getElementData(plr,"player:uid"))
else
exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_vehicles (wariant,model,ownedPlayer,mileage,registered,parking,firstowner) VALUES (?,?,?,?,?,1,?)", wariant, model, getElementData(plr,"player:uid"),mileage,"true",getElementData(plr,"player:uid"))
end
--triggerClientEvent(plr,"addNotification",root,string.format("Zakupi?e? sw?j pojazd "..getVehicleNameFromModel(model)..", znajdziesz go w przechowywalni."),"info")
plr:setData("player:vehicles", plr:getData("player:vehicles") + 1)
plr:outputChat('Zakupi?e? sw?j pojazd znajdziesz go w przechowywalni!')
else
plr:outputChat('Osi?gn??e? limit pojazd?w: '..limit+1)
end
end)
[/code]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-06-27, 21:03


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Nie dzia?a czyli co, jakie??b??dy? Przecinki s? w z?ym miejscu?

setElementData(veh,'opis','Pojazd: '..v[1]..'\n\nCena: '..przecinkimagic(cena)..' PLN\nPrzebieg: '..przebieg..' km \nChcesz zakupi? pojazd '..v[1]..' \nwsi?d? do niego i wpisz /kuppojazd'


Podmie? t? linijk? i sprawd?.

Ostatnio zmieniony przez Wilq 2019-06-27, 21:05, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-06-27, 21:05


kerfyn

Hyp3R






Wiek: 25
Na forum: 2739 dni
Posty: 121
Nick w MP: Hyp3R

Piwa: 2

Respekt: 50

No chc? aby zamiast 9000000 pisa?o 9,000,000 a og?lnie salony bez "przecink?w" dzia?aj? tylko jak wpisuje przecinek to nie dziala

Ostatnio zmieniony przez kerfyn 2019-06-27, 21:06, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-06-27, 21:05


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Podmie? t? linijk?:
setElementData(veh,'opis','Pojazd: '..v[1]..'\n\nCena: '..przecinkimagic(cena)..' PLN\nPrzebieg: '..przebieg..' km \nChcesz zakupi? pojazd '..v[1]..' \nwsi?d? do niego i wpisz /kuppojazd'


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 2 piw(a):
kerfyn, NorbiTTT
Wysłany: 2019-06-27, 21:07


kerfyn

Hyp3R






Wiek: 25
Na forum: 2739 dni
Posty: 121
Nick w MP: Hyp3R

Piwa: 2

Respekt: 50

Oo wilq mistrzem jeste? xD dzi?ki za pomoc dzia?a wszystko Oczywi?cie piwo zostawiam Mo?na zamkn??

Postaw piwo autorowi tego posta
 

 
Tagi: przecinki :: salonie :: 000 :: 000
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