Wysłany: 2018-04-29, 22:47
Songo23
Wiek: 23 Na forum: 3047 dni Posty: 37
Nick w MP: Songo23
Piwa : 665
Witam!
Mam problem z organizacjami, a dok?adniej chcia?em ogarnac jakies fajne tworzenie organiazcji na pysa, ale mam problem, poniewa? gdy tworze org, to wyskakuje mi jakis error w db3. Pom?g?by kto??
db3:
ERROR: organizacje/s.lua:49 attemp to index global 'source; (a userdata value)
Linijka 49:
local uid = source : getData ( "player:sid" )
ca?y kod:
local data = { cost = 250000 }
function refreshgui ( element )
local uid = element : getData ( "player:sid" )
if not uid then return false end
local result = exports [ "DB2" ]: dbGet ( "SELECT pystories_vehicles.model,pystories_vehicles.id,pystoriesvehicles.ownedGroup,ogrpg_organization_list.name FROM pystoriesvehicles left join ogrpg_organization_list on ogrpg_organization_list.id=pystories_vehicles.ownedGroup WHERE ownedPlayer=?" , uid )
triggerClientEvent ( element , "org:refresh" , resourceRoot , result )
end
addEvent ( "org:download" , true )
addEventHandler ( "org:download" , resourceRoot , refreshgui )
addEvent ( "org:check" , true )
addEventHandler ( "org:check" , resourceRoot , function( id , name )
local uid = client : getData ( "player:sid" )
if not uid then return false end
local result = exports [ "DB2" ]: dbGet ( "SELECT * FROM pystories_vehicles WHERE id=? AND ownedPlayer=?" , id , uid )
if #result < 0 then
return triggerClientEvent ( client , "onClientAddNotification" , client , "Nie jeste? w?a?cicielem tego pojazdu!" , "error" )
end
local result = exports [ "DB2" ]: dbGet ( "SELECT * FROM pystories_vehicles WHERE id=? AND parking=0" , id )
if #result > 0 then
return triggerClientEvent ( client , "onClientAddNotification" , client , "Pojazd nie znajduje si? w przechowalni!" , "error" )
end
local result = exports [ "DB2" ]: dbGet ( "SELECT * FROM pystories_vehicles WHERE id=? AND ownedPlayer=?" , id , uid )
if #result > 0 then
if result [ 1 ]. ownedGroup ~= "0" then
local query = exports [ "DB2" ]: dbSet ( "UPDATE pystories_vehicles SET ownedGroup=0 WHERE id=? AND ownedPlayer=?" , id , uid )
triggerClientEvent ( client , "onClientAddNotification" , client , "Zmieni?e?(a?) pojazdowi " .. name .. " [ID: " .. id .. "] przypis na siebie." , "success" )
refreshgui ( client )
return
end
local org = getElementData ( client , "player:organization:id" )
if not org then return triggerClientEvent ( client , "onClientAddNotification" , client , "Nie nale?ysz do ?adnej organizacji!" , "error" ) end
local query = exports [ "DB2" ]: dbSet ( "UPDATE pystories_vehicles SET ownedGroup=? WHERE id=? AND ownedPlayer=?" , org , id , uid )
if query then
triggerClientEvent ( client , "onClientAddNotification" , client , "Zmieni?e?(a?) pojazdowi " .. name .. " [ID: " .. id .. "] przypis na organizacj?." , "success" )
refreshgui ( client )
end
end
end )
addEvent ( "org:create" , true )
addEventHandler ( "org:create" , root , function( name )
local uid = source : getData ( "player:sid" )
if not uid then return false end
local result = exports [ "DB2" ]: dbGet ( "SELECT * FROM ogrpg_organization_list WHERE name=?" , name )
if #result == 0 and source.money >= data.cost then
exports [ "DB2" ]: dbSet ( "INSERT INTO ogrpg_organization_list (name) VALUES (?)" , name )
local result = exports [ "DB2" ]: dbGet ( "SELECT * FROM ogrpg_organization_list where name=?" , name )
exports [ "DB2" ]: dbSet ( "INSERT INTO ogrpg_organizations (code, uid, rank) VALUES (?,?,?)" , result [ 1 ]. id , uid , 4 )
setElementData ( source , "player:organization" , name )
setElementData ( source , "player:organization:id" , result [ 1 ]. id )
triggerClientEvent ( source , "onClientAddNotification" , source , "Pomy?lnie stworzy?e?(a?) organizacj? o nazwie " .. name .. "!" , "success" )
source : takeMoney ( data . cost )
else
triggerClientEvent ( source , "onClientAddNotification" , source , "Istnieje ju? taka organizacja b?d? nie posiadasz 200.000PLN!" , "error" )
end
end )
Ostatnio zmieniony przez Songo23 2018-04-29, 22:53, w całości zmieniany 1 raz
Wysłany: 2018-04-29, 22:52
Atroth
Wiek: 23 Na forum: 3677 dni Posty: 1089
Nick w MP: Atroth
Piwa : 4808
Songo23 , Poka? linijk? 49. Pokazuj zawsze dok?adn? linijk?, o kt?r? chodzi.
Podpis
Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018
Ostatnio zmieniony przez Atroth 2018-04-29, 22:54, w całości zmieniany 1 raz
Wysłany: 2018-04-29, 22:53
Songo23
Wiek: 23 Na forum: 3047 dni Posty: 37
Nick w MP: Songo23
Piwa : 665
"Atroth" napisał/a :Songo23 , Poka? linijk? 49. Pokazuj zawsze dok?adn? linijk?, o kt?r? chodzi.
Poprawione, dzi?ki.
Wysłany: 2018-04-29, 22:55
Atroth
Wiek: 23 Na forum: 3677 dni Posty: 1089
Nick w MP: Atroth
Piwa : 4808
Songo23 , Spr?buj da? zamiast source client. Nigdy ogrpg i innych typu rzeczy nie "naprawia?em", wi?c nie wiem czy to pomo?e
Podpis
Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018
Tagi: organizacje
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: