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

Wysłany: 2016-10-26, 19:18


polaczkos







Wiek: 25
Na forum: 4085 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

mam taki skrypt na salon lecz gdy kupie kojazd to nastepny sie nie spawni

Kod:


local pojazdy = {}
pojazdy[410] = { -1946.18,266.41,40.69,359.4,0.1,356.0,2000,math.random(0,25)}
pojazdy[579] = { 2134.88,-1133.76,25.62,359.2,0.3,87.7,39000,math.random(0,25)}
pojazdy[559] = { 2135.23,-1138.86,25.11,359.3,353.6,87.4,54000,math.random(0,25)}
pojazdy[480] = { 2135.16,-1143.70,24.71,358.7,353.7,92.6,31500,math.random(0,25)}
pojazdy[576] = { 2121.61,-1157.06,23.73,357.6,2.3,1.2,22000,math.random(0,25)}
pojazdy[412] = { 2117.12,-1157.08,24.19,359.0,6.4,0.5,16000,math.random(0,25)}
pojazdy[551] = { 2119.56,-1135.81,25.00,358.9,4.0,222.4,45000,math.random(0,25)}
pojazdy[586] = { 2120.03,-1130.43,25.07,0.8,2.2,227.6,28000,math.random(0,25)}
pojazdy[507] = { 2120.25,-1124.58,25.23,0.7,2.0,224.7,64000,math.random(0,25)}

for i,v in pairs(pojazdy) do
local wystawa = createVehicle(i,v[1],v[2],v[3],v[4],v[5],v[6])
setVehicleDamageProof(wystawa,true)
setElementFrozen(wystawa,true)
setElementData(wystawa,"pojazd_przebieg",v[8])
setElementData(wystawa,"dokupienia",true)
setElementData(wystawa,"cena",v[7])
setVehiclePlateText(wystawa, " Salon SF")
setVehicleColor(wystawa, 255,255,255, 255,255,255)
addVehicleUpgrade(wystawa, 1073 )
end

function zrespponownie(id)
if pojazdy[id] then
local wystawa = createVehicle(id,pojazdy[id][1],pojazdy[id][2],pojazdy[id][3],pojazdy[id][4],pojazdy[id][5],pojazdy[id][6])
setVehicleDamageProof(wystawa,true)
setElementFrozen(wystawa,true)
setElementData(wystawa,"pojazd_przebieg",pojazdy[id][8])
setElementData(wystawa,"dokupienia",true)
setElementData(wystawa,"cena",pojazdy[id][7])
setVehiclePlateText(wystawa, " Salon SF")
setVehicleColor(wystawa, 150, 0, 0, 150, 0, 0 )
addVehicleUpgrade(wystawa, 1073 )
end
end

function kup(plr)
local v = getPedOccupiedVehicle(plr)
if getElementData(v,"dokupienia") then
local id = getElementModel(v)
if pojazdy[id] then
local cena = pojazdy[id][7]
if cena then
if getPlayerMoney(plr) >= cena then
takePlayerMoney(plr, cena)
local przebieg = getElementData(v,"pojazd_przebieg")
local x,y,z = getElementPosition(v)
local rotx,roty,rotz = getElementRotation(v)
local r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4 = getVehicleColor(v,true)
local hr,hg,hb = getVehicleHeadLightColor(v)
local account = getPlayerAccount(plr)
local wlasciciel = getAccountName(account)
--<<-->>
local query = dbQuery(handler, "INSERT INTO pojazdy (wlasciciel, model, x, y, z, rot, r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4, przebieg, paliwo) VALUES (?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", wlasciciel, id, x, y, z, rotx, r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4, przebieg, 60)
local result, num_affected_rows, last_insert_id = dbPoll(query, -1)
dbExec(handler, "INSERT INTO tuning (id, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, paintjob, hr, hg, hb) VALUES (?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", last_insert_id, "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "3", hr,hg,hb)
--<<-->>
destroyElement(v)
local pojazd = createVehicle(id,x,y,z,rx,ry,rz)
warpPedIntoVehicle(plr,pojazd)
local query = dbQuery(handler, "SELECT * FROM pojazdy")
local result, num_rows, errormsg = dbPoll (query, -1)
for i,v in pairs(result) do
setElementRotation(pojazd,rotx,roty,rotz)
setElementData(pojazd, "pojazdy_paliwo", v["paliwo"] or 100)
setElementData(pojazd, "pojazdy_przebieg", v["przebieg"] or 0)
setVehicleColor(pojazd, v["r1"],v["g1"],v["b1"],v["r2"],v["g2"],v["b2"],v["r3"],v["g3"],v["b3"],v["r4"],v["g4"],v["b4"])
setElementData(pojazd, "car_id", v["id"])
setElementData(pojazd, "car_owner", v["wlasciciel"])
setVehiclePlateText(pojazd, "SF "..v["id"])
setVehicleColor(pojazd, 150, 0, 0, 150, 0, 0 )
addVehicleUpgrade(pojazd, 1096 )
end
setTimer(function()
zrespponownie(id)
end,50,1)
else
outputChatBox("*Nie masz tyle pieni?dzy. Potrzebujesz PLN "..cena,plr,0,0,0,true)
end
end
end
end
end
addCommandHandler("kuppojazd",kup)


prosz? o pomoc

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-10-26, 20:15


PapaSmerf







Wiek: 25
Na forum: 3525 dni
Posty: 237

Piwa: 3857

Respekt: 64

zr?b automatyczny restart skryptu i bedzie git

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-10-26, 20:20


polaczkos







Wiek: 25
Na forum: 4085 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

CEO ale wtedy wszystkie auta beda sie resetowac a ja chcem zeby po kupnie pojawi?o si? nast?pne do kupna

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-10-26, 20:26


PapaSmerf







Wiek: 25
Na forum: 3525 dni
Posty: 237

Piwa: 3857

Respekt: 64


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


[ Dodano: 2016-10-26, 20:26 ]
Dodaj to po zakupieniu pojazdu

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-10-26, 20:50


Przegryw







Wiek: 23
Na forum: 3509 dni
Posty: 9



Respekt: 45,3

Ostrzeżeń: 100%
"CEO" napisał/a:


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


[ Dodano: 2016-10-26, 20:26 ]
Dodaj to po zakupieniu pojazdu


A gdzie tutaj jest mowa o kupnie pojazdu ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-10-26, 21:04


.RiV







Wiek: 25
Na forum: 3587 dni
Posty: 554
Nick w MP: Split

Piwa: 2596

Respekt: 597,8
Respekt: 597,8

"CEO" napisał/a:


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


[ Dodano: 2016-10-26, 20:26 ]
Dodaj to po zakupieniu pojazdu


"CEO" napisał/a:

Dodaj to po zakupieniu pojazdu



function kup(plrlocal v getPedOccupiedVehicle(plr) 
if getElementData(v,"dokupienia"then 
local id getElementModel(v) 
if pojazdy[idthen 
local cena pojazdy[id][7] 
if cena then 
if getPlayerMoney(plr) >= cena then 
takePlayerMoney(plrcenalocal przebieg getElementData(v,"pojazd_przebieg"local x,y,getElementPosition(vlocal rotx,roty,rotz getElementRotation(vlocal r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4 getVehicleColor(v,truelocal hr,hg,hb getVehicleHeadLightColor(vlocal account getPlayerAccount(plrlocal wlasciciel getAccountName(account) 
--<<-->> 
local query dbQuery(handler"INSERT INTO pojazdy (wlasciciel, model, x, y, z, rot, r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4, przebieg, paliwo) VALUES (?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"wlascicielidxyzrotxr1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4przebieg60local resultnum_affected_rowslast_insert_id dbPoll(query, -1dbExec(handler"INSERT INTO tuning (id, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, paintjob, hr, hg, hb) VALUES (?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"last_insert_id"0""0""0""0""0""0""0""0""0""0""0""0""0""0""0""0""0""3"hr,hg,hb) 
--<<-->> 
destroyElement(vlocal pojazd createVehicle(id,x,y,z,rx,ry,rzwarpPedIntoVehicle(plr,pojazdlocal query dbQuery(handler"SELECT * FROM pojazdy"local resultnum_rowserrormsg dbPoll (query, -1) 
for i,v in pairs(result) do 
setElementRotation(pojazd,rotx,roty,rotzsetElementData(pojazd"pojazdy_paliwo"v["paliwo"] or 100setElementData(pojazd"pojazdy_przebieg"v["przebieg"] or 0setVehicleColor(pojazdv["r1"],v["g1"],v["b1"],v["r2"],v["g2"],v["b2"],v["r3"],v["g3"],v["b3"],v["r4"],v["g4"],v["b4"]) 
setElementData(pojazd"car_id"v["id"]) 
setElementData(pojazd"car_owner"v["wlasciciel"]) 
setVehiclePlateText(pojazd"SF "..v["id"]) 
setVehicleColor(pojazd150001500addVehicleUpgrade(pojazd1096 end 
setTimer(function() 
zrespponownie(idend,50,1) 
else 
outputChatBox("*Nie masz tyle pieni?dzy. Potrzebujesz PLN "..cena,plr,0,0,0,trueend 
end 
end 
end 
end 
addCommandHandler("kuppojazd",kup)


Zamie? na:

function kup(plrlocal v getPedOccupiedVehicle(plr) 
if getElementData(v,"dokupienia"then 
local id getElementModel(v) 
if pojazdy[idthen 
local cena pojazdy[id][7] 
if cena then 
if getPlayerMoney(plr) >= cena then 
takePlayerMoney(plrcenalocal przebieg getElementData(v,"pojazd_przebieg"local x,y,getElementPosition(vlocal rotx,roty,rotz getElementRotation(vlocal r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4 getVehicleColor(v,truelocal hr,hg,hb getVehicleHeadLightColor(vlocal account getPlayerAccount(plrlocal wlasciciel getAccountName(account) 
--<<-->> 
local query dbQuery(handler"INSERT INTO pojazdy (wlasciciel, model, x, y, z, rot, r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4, przebieg, paliwo) VALUES (?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"wlascicielidxyzrotxr1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4przebieg60local resultnum_affected_rowslast_insert_id dbPoll(query, -1dbExec(handler"INSERT INTO tuning (id, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, paintjob, hr, hg, hb) VALUES (?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"last_insert_id"0""0""0""0""0""0""0""0""0""0""0""0""0""0""0""0""0""3"hr,hg,hb) 
--<<-->> 
destroyElement(vlocal pojazd createVehicle(id,x,y,z,rx,ry,rzwarpPedIntoVehicle(plr,pojazdlocal query dbQuery(handler"SELECT * FROM pojazdy"local resultnum_rowserrormsg dbPoll (query, -1) 
for i,v in pairs(result) do 
setElementRotation(pojazd,rotx,roty,rotzsetElementData(pojazd"pojazdy_paliwo"v["paliwo"] or 100setElementData(pojazd"pojazdy_przebieg"v["przebieg"] or 0setVehicleColor(pojazdv["r1"],v["g1"],v["b1"],v["r2"],v["g2"],v["b2"],v["r3"],v["g3"],v["b3"],v["r4"],v["g4"],v["b4"]) 
setElementData(pojazd"car_id"v["id"]) 
setElementData(pojazd"car_owner"v["wlasciciel"]) 
setVehiclePlateText(pojazd"SF "..v["id"]) 
setVehicleColor(pojazd150001500addVehicleUpgrade(pojazd1096 end
zrespponownie(id) 
else 
outputChatBox("*Nie masz tyle pieni?dzy. Potrzebujesz PLN "..cena,plr,0,0,0,trueend 
end 
end 
end 
end 
addCommandHandler("kuppojazd",kup)


Podpis

Autor OGRPG, na scenie MTA od 2012 roku.




Użytkownik: 08.08.2016
GTAO Member: 06.02.2017
Support-Team: 17.06.2017 & 01.06.2019 - 18.11.2019
Moderator: 14.01.2018 - 09.08.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-10-26, 21:15


polaczkos







Wiek: 25
Na forum: 4085 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

dalej nie dzia?a

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-10-26, 21:51


PapaSmerf







Wiek: 25
Na forum: 3525 dni
Posty: 237

Piwa: 3857

Respekt: 64


addCommandHandler('kuppojazd', function(plrcmd)
    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


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-10-27, 13:04


polaczkos







Wiek: 25
Na forum: 4085 dni
Posty: 168
Nick w MP: polaczkos

Piwa: 3

Respekt: 45,3

Kod:

local data=plr:getData('vehsell:info')
w tej linjce
pokazuje mi b??d z "plr"

[ Dodano: 2016-10-30, 12:39 ]
Ju? zrobi?em usune?em
Kod:

destroyElement(v)
dzieki temu pojazd ciagle jest i nie musze sie meczyc z respawnem :D

[ Dodano: 2016-10-30, 13:02 ]
do zamkni?cia

Postaw piwo autorowi tego posta
 

 
Tagi: salon :: respawn :: pojazdów
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