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

Wysłany: 2014-12-10, 21:23


Terr9909

Skrypter LUA






Wiek: 27
Na forum: 4375 dni
Posty: 346
Nick w MP: Split

Piwa: 1043

Respekt: 182,8
Respekt: 182,8Respekt: 182,8

Witajcie, znacie poprawne zastosowanie zapytania dbExec?
Chodzi mi o zastosowanie aby mo?na by?o wci?gn?? np opis ze stringem, jak dodaje rzeczy kt?re maj? np kropki lub przecinki w sobie to ju? b??dy si? wywalaj?.

dbExec(connection, "UPDATE hp_vehicles SET model='?', loc='?,?,?' WHERE id='1'",
model, x,y,z)


w?a?nie przez lokalizacj? pojazdu te b??dy si? pokazuj?, a z modelu ju? nie, mo?na to jako? naprawi??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-12, 16:20


Tostuch







Wiek: 28
Na forum: 5072 dni
Posty: 483
Nick w MP: Tost

Piwa: 137

Respekt: 110
Respekt: 110

Po co ci cudzys?owy? Nie trzeba :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-12, 17:25


Terr9909

Skrypter LUA






Wiek: 27
Na forum: 4375 dni
Posty: 346
Nick w MP: Split

Piwa: 1043

Respekt: 182,8
Respekt: 182,8Respekt: 182,8

wole mie? ju? aby bajzlu nie by?o.
nie dzia?a te? po zmianie tego

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-12, 17:39


Tey







Wiek: 31
Na forum: 5017 dni
Posty: 155
Nick w MP: l0nger

Piwa: 281

Respekt: 193
Respekt: 193Respekt: 193

Zastosuj po prostu formatowanie tekstu. Pokaze Ci na przykladzie.

dbExec(connection, "UPDATE hp_vehicles SET model=?, loc=? WHERE id=1", model, ("%.2f, %.2f, %.2f"):format(x,y,z))


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-13, 11:53


Terr9909

Skrypter LUA






Wiek: 27
Na forum: 4375 dni
Posty: 346
Nick w MP: Split

Piwa: 1043

Respekt: 182,8
Respekt: 182,8Respekt: 182,8

co tutaj jest b??dem wy?wietla si? b??d z trzeciej linijki zapytania z tuningu, co? tam string itp.

    local damage = {}
    local model = getElementModel(vehicle)
    local health = getElementHealth(vehicle)
    local x,y,z = getElementPosition(vehicle)
    local board = getVehiclePlateText(vehicle)
    local c1,c2,c3,c4 = getVehicleColor(vehicle)
    local r1,r2,r3 = getElementRotation(vehicle)
    local h1,h2,h3 = getVehicleHeadLightColor(vehicle)

    for i=0,6 do table.insert(damage, getVehiclePanelState(vehicle, i)) end
    local tuning = table.concat(getVehicleUpgrades(vehicle), ",")
    local damage = table.concat(damage, ",")

    local id = getElementData(vehicle, "vehicle_id")
    local frozen = isElementFrozen(vehicle) and 1 or 0
    local desc = getElementData(vehicle, "vehicle_desc")
    local fuel = getElementData(vehicle, "vehicle_fuel")
    local group = getElementData(vehicle, "vehicle_group")
    local owner = getElementData(vehicle, "vehicle_owner")
    local driver = getElementData(vehicle, "vehicle_driver")
    local faction = getElementData(vehicle, "vehicle_faction")
    local mileage = getElementData(vehicle, "vehicle_mileage")

    dbExec(connection, "UPDATE hp_vehicles SET model=?, loc=?, rot=?, color=?, lights=?, board=?, desc=?, mileage=?, fuel=?, damage=?, tuning=?, health=?, group=?, frozen=?, driver=?, faction=?, owner=? WHERE id=?",
    model,("%.2f, %.2f, %.2f"):format(x,y,z),("%.2f, %.2f, %.2f"):format(r1,r2,r3),("%.2f, %.2f, %.2f, %.2f"):format(c1,c2,c3,c4),("%.2f, %.2f, %.2f"):format(h1,h2,h3),board,desc,mileage,fuel,("%.2f"):format(damage),
    ("%.2f"):format(tuning),health,group,frozen,driver,faction,owner,id)


Postaw piwo autorowi tego posta
 

 
Tagi: mysql :: system :: 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 » Mysql - System pojazdów 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