Wysłany: 2016-01-14, 14:34
sebik2303
Mapper :)
Wiek: 25 Na forum: 4160 dni Posty: 298
Nick w MP: sebik2303
Piwa : 899
Witam, mam kod na przecho lecz ka?dy mo?e moje auto wyci?ga?, i jest DB w tej linijce: 69 for i , v in ipairs ( w [ 1 ]. Calyy ) do
Licz? o pomoc
Wysłany: 2016-01-14, 17:07
Novovix
xNinja powraca
Wiek: 26 Na forum: 4870 dni Posty: 240
Nick w MP: xNinja
Piwa : 452
W zapytaniu musisz doda? to ... WHERE =? ",login_gracza)
Wysłany: 2016-01-14, 19:37
sebik2303
Mapper :)
Wiek: 25 Na forum: 4160 dni Posty: 298
Nick w MP: sebik2303
Piwa : 899
Novovix , da?em tak:
addCommandHandler ( "odbierz" ,function( plr , cmd , idd )
if idd then
if isElementWithinMarker ( plr , odb ) then
local q = dbQuery ( polaczenie , "SELECT * FROM `Zapis` WHERE `ID`=? `WHERE=?`" , login_gracza , idd )
local w = dbPoll ( q ,- 1 )
dbFree ( q )
local auto = createVehicle ( w [ 1 ]. Model ,- 1770.47 , 958.27 , 24.64 , 0.2 , 0.0 , 180.0 )
warpPedIntoVehicle ( plr , auto )
setElementData ( auto , "pojazd_paliwo" , w [ 1 ]. Paliwo )
setElementData ( auto , "car_id" , w [ 1 ]. ID )
setVehiclePaintjob ( auto , w [ 1 ]. Paintjob )
setElementData ( auto , "wlasciciel" , w [ 1 ]. Owner )
setElementData ( auto , "pojazd_przebieg" , w [ 1 ]. Przebieg )
setVehicleColor ( auto , w [ 1 ]. color1 , w [ 1 ]. color2 , w [ 1 ]. color3 , w [ 1 ]. color4 )
setVehicleTuning ( auto , w [ 1 ]. Tuning )
setVehicleHeadLightColor ( auto , w [ 1 ]. RS , w [ 1 ]. GS , w [ 1 ]. BS )
setElementHealth ( auto , tonumber ( w [ 1 ]. hpauta ))
setVehicleWheelStates ( auto , w [ 1 ]. PP1 , w [ 1 ]. PL1 , w [ 1 ]. TP1 , w [ 1 ]. TL1 )
for i , v in ipairs ( w [ 1 ]. Calyy ) do
setVehiclePanelState ( auto , i - 1 , tonumber ( v ))
end
for i , v in ipairs ( w [ 1 ]. Drzwii ) do
setVehicleDoorState ( auto , i - 1 , tonumber ( v ))
end
dbExec ( polaczenie , "DELETE FROM `Zapis` WHERE `ID`=? `WHERE=?`" , login_gracza , idd )
if idd == getElementData ( auto , "car_id" ) then
end
end
end
end )
mam tak i db
Wysłany: 2016-01-14, 21:51
Novovix
xNinja powraca
Wiek: 26 Na forum: 4870 dni Posty: 240
Nick w MP: xNinja
Piwa : 452
Nie mo?esz da?, lub mo?na ale w inny spos?b 2x WHERE, nawet nie zdefiniowa?e? loginu gracza. Rozumiem, ?e to nie tw?j kod ? hmm odno?nik do WIKI pobieranie loginu gracza,
Wysłany: 2016-01-14, 22:03
sebik2303
Mapper :)
Wiek: 25 Na forum: 4160 dni Posty: 298
Nick w MP: sebik2303
Piwa : 899
Novovix , dam ci ca?y kod
local polaczenie = dbConnect ( "sqlite" , "db.db" )
if polaczenie then
outputDebugString ( "Wczytano pojazdy z przechowywalni" )
else
outputDebugString ( "Nie wczytano pojazd?w z przechowywalni" )
end
dbExec ( polaczenie , "CREATE TABLE IF NOT EXISTS Zapis ( Calyy INTEGER, Drzwii INTEGER, PP1 INTEGER, PL1 INTEGER, TP1 INTEGER, TL1 INTEGER, hpauta INTEGER, RS INTEGER, GS INTEGER, BS INTEGER, Tuning INTEGER, Przebieg INTEGER, ID INTEGER, Model INTEGER, Paintjob INTEGER, Paliwo INTEGER, Owner VARCHAR, color1 INTEGER, color2 INTEGER, color3 INTEGER, color4 INTEGER)" )
marker = createMarker (- 1756.36 , 951.36 , 23.74 , "cylinder" , 6 , 68 , 212 , 4 , 100 )
odb = createMarker ( - 1762.80859375 , 963.3046875 , 24.8828125 , "cylinder" , 1 , 255 , 0 , 0 , 100 )
function oddajAutodoprzecho ( e )
if source == marker then
if getElementType ( e )== "vehicle" then
local idd = getElementData ( e , "car_id" )
local paliwo = getElementData ( e , "pojazd_paliwo" )
if idd then
local owner = getElementData ( e , "wlasciciel" )
local model = getElementModel ( e )
local paint = getVehiclePaintjob ( e )
local przeb = getElementData ( e , "pojazd_przebieg" )
local upgrade = getVehicleTuning ( e )
local c1 , c2 , c3 , c4 = getVehicleColor ( e )
local rs , gs , bs = getVehicleHeadLightColor ( e )
local autohp = getElementHealth ( e )
local pp1 , pl1 , tp1 , tl1 = getVehicleWheelStates ( e )
local caly = {}
for i = 0 , 6 do table . insert ( caly , getVehiclePanelState ( e , i )) end
local caly = table . concat ( caly , "," )
local drzwi = {}
for i = 0 , 5 do table . insert ( drzwi , getVehicleDoorState ( e , i )) end
local drzwi = table . concat ( drzwi , "," )
dbExec ( polaczenie , "INSERT INTO `Zapis` ( Calyy, Drzwii, PP1, PL1, TP1, TL1, hpauta, RS, GS, BS, Przebieg, Tuning, color1, color2 ,color3, color4, ID, Model,Paintjob,Paliwo,Owner) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" , caly , drzwi , pp1 , pl1 , tp1 , tl1 , autohp , rs , gs , bs , przeb , upgrade , c1 , c2 , c3 , c4 , idd , model , paint , paliwo , owner )
destroyElement ( e )
outputChatBox ( "Schowa?e? sw?j pojazd do przechowywalni aut." )
end
end
elseif source == odb then
if getElementType ( e )== "vehicle" then
local q = dbQuery ( polaczenie , "SELECT * FROM `Zapis` WHERE `Owner`=?" , getPlayerName ( e ))
local w = dbPoll ( q ,- 1 )
dbFree ( q )
for _ , v in ipairs ( w )do
end
end
end
end
addEventHandler ( "onMarkerHit" , root , oddajAutodoprzecho )
addCommandHandler ( "odbierz" ,function( plr , cmd , idd )
if idd then
if isElementWithinMarker ( plr , odb ) then
local q = dbQuery ( polaczenie , "SELECT * FROM `Zapis` WHERE `ID`=? `WHERE`=? " , Owner , idd )
local w = dbPoll ( q ,- 1 )
dbFree ( q )
local auto = createVehicle ( w [ 1 ]. Model ,- 1770.47 , 958.27 , 24.64 , 0.2 , 0.0 , 180.0 )
warpPedIntoVehicle ( plr , auto )
setElementData ( auto , "pojazd_paliwo" , w [ 1 ]. Paliwo )
setElementData ( auto , "car_id" , w [ 1 ]. ID )
setVehiclePaintjob ( auto , w [ 1 ]. Paintjob )
setElementData ( auto , "wlasciciel" , w [ 1 ]. Owner )
setElementData ( auto , "pojazd_przebieg" , w [ 1 ]. Przebieg )
setVehicleColor ( auto , w [ 1 ]. color1 , w [ 1 ]. color2 , w [ 1 ]. color3 , w [ 1 ]. color4 )
setVehicleTuning ( auto , w [ 1 ]. Tuning )
setVehicleHeadLightColor ( auto , w [ 1 ]. RS , w [ 1 ]. GS , w [ 1 ]. BS )
setElementHealth ( auto , tonumber ( w [ 1 ]. hpauta ))
setVehicleWheelStates ( auto , w [ 1 ]. PP1 , w [ 1 ]. PL1 , w [ 1 ]. TP1 , w [ 1 ]. TL1 )
for i , v in ipairs ( w [ 1 ]. Calyy ) do
setVehiclePanelState ( auto , i - 1 , tonumber ( v ))
end
for i , v in ipairs ( w [ 1 ]. Drzwii ) do
setVehicleDoorState ( auto , i - 1 , tonumber ( v ))
end
dbExec ( polaczenie , "DELETE FROM `Zapis` WHERE `ID`=? `WHERE`=?" , Owner , idd )
if idd == getElementData ( auto , "car_id" ) then
end
end
end
end )
function info ( plr )
outputChatBox ( "Aby odebra? swoje auto wpisz /odbierz <ID Auta>" , plr )
end
addEventHandler ( "onMarkerHit" , odb , info )
function getVehicleTuning ( veh )
local i
local vehPanel = ''
for i = 0 , 15 do
local vb = ''
if i > 0 then
vb = vehPanel .. ';'
end
vehPanel = vb .. getVehicleUpgradeOnSlot ( veh , i )
end
return vehPanel
end
function setVehicleTuning ( veh , arr )
if arr then
local arrx = split ( arr , string . byte ( ";" ))
local i
for i = 0 , 15 do
addVehicleUpgrade ( veh , arrx [ i ] )
end
end
return true
end
Co dalej trza zrobi? z getAccountName?
Wysłany: 2016-01-15, 12:25
Novovix
xNinja powraca
Wiek: 26 Na forum: 4870 dni Posty: 240
Nick w MP: xNinja
Piwa : 452
Tak. Nie b?d? robi? gotowca, ale poda?em ci co masz zrobi? i widz?, ?e nie znasz podstaw, do tego nie tw?j kod, tylko edytowany
Tagi: przechowywalnia
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: