Wysłany: 2016-11-19, 01:39
macieq.
Grafik
Wiek: 28 Na forum: 3513 dni Posty: 42
Nick w MP: 1Macieq
Cze??,
Jak wida? na ss nie dzia?a mi login i nie wiem co to jest, wszystko jest podpi?te
[ Dodano : 2016-11-19, 01:40 ]
addEvent ( "onClientSendRegisterDataToServer" , true )
addEventHandler ( "onClientSendRegisterDataToServer" , getRootElement (), dodaj )
addEvent ( "logging:checkAccount" , true )
addEventHandler ( "logging:checkAccount" , resourceRoot , function( login , pass )
local result = exports [ "og-db" ]: getRekord ( "SELECT * FROM og_users WHERE login=?" , login )
if result and #result > 0 then
if result [ 1 ]. login == login and result [ 1 ]. pass == md5 ( pass ) then
setPlayerName ( client , login )
setElementData ( client , "player:uid" , result [ 1 ]. id )
triggerClientEvent ( client , "logging:result" , resourceRoot , true , nil )
else
triggerClientEvent ( client , "logging:result" , resourceRoot , false , "Podane dane s? nieprawid?owe." )
end
else
triggerClientEvent ( client , "logging:result" , resourceRoot , false , "Podany login nie istnieje w bazie." )
end
end )
addEvent ( "onClientSendRegisterDataToServer" , true )
addEventHandler ( "onClientSendRegisterDataToServer" , getRootElement (), dodaj )
addEvent ( "logging:newAccount" , true )
addEventHandler ( "logging:newAccount" , resourceRoot , function( login , pass )
local result = exports [ "og-db" ]: getRekord ( "SELECT * FROM og_users WHERE login=?" , login )
if result and #result > 0 then
triggerClientEvent ( client , "logging:result" , resourceRoot , false , "Podany login ju? istnieje w bazie." )
else
local query = exports [ "og-db" ]: setRekord ( "INSERT INTO og_users (login,pass) VALUES (?,?)" , login , md5 ( pass ))
if query then
triggerClientEvent ( client , "logging:result" , resourceRoot , false , "Pomy?lnie zalogowa?e?(a?) si?" )
end
end
end )
addEvent ( "core:spawnPlayer" , true )
addEventHandler ( "core:spawnPlayer" , resourceRoot , function()
local pozycja = getElementData ( source , "player:spawn" )
spawnPlayer ( source , pozycja , 90.0 , 0 )
fadeCamera ( source , false )
end )
Wysłany: 2016-11-19, 17:06
Pawel5321
Szkrypter
Wiek: 36 Na forum: 3809 dni Posty: 237
Nick w MP: Pawell
Piwa : 2315
czy w mecie og-db jest:
< export function= "getRekord" type = "server" />
< export function= "setRekord" type = "server" />
i czy strony si? zgadzaj??
Wysłany: 2016-11-19, 23:21
macieq.
Grafik
Wiek: 28 Na forum: 3513 dni Posty: 42
Nick w MP: 1Macieq
--[[
Resource : OURGame v2
Developers : Split < split . programista @ gmail . com >
Copyright < split . programista @ gmail . com > 2015 - 2016
You have no right to use this code without my permission .
@ update 25 / 03 / 2015
- Dodano Po ?? czenie MYSQL .
]]
-- Settings
SQL_HANDLER = nil
SQL_HOST = "****"
SQL_DBNAME = "****"
SQL_DBUSER = "****"
SQL_DBPASS = "****"
-- Functions
local function onConnect ()
SQL_HANDLER = dbConnect ( "mysql" , "dbname=" .. SQL_DBNAME .. ";host=" .. SQL_HOST .. "" , SQL_DBUSER , SQL_DBPASS , "share=1" );
if SQL_HANDLER then
outputDebugString ( "<og-db> Connecting to MYSQL..." );
else
outputDebugString ( "<og-db> No Connecting to MYSQL..." );
end
end
function setRekord (...)
if not {...} then return end
local query = dbExec ( SQL_HANDLER , ...)
return query
end
function dbSet (...)
if not {...} then return end
local query = dbExec ( SQL_HANDLER , ...)
return query
end
function getRekord (...)
if not {...} then return end
local query = dbQuery ( SQL_HANDLER , ...)
local result = dbPoll ( query , - 1 )
return result
end
function dbGet (...)
if not {...} then return end
local query = dbQuery ( SQL_HANDLER , ...)
local result = dbPoll ( query , - 1 )
return result
end
function zapytanie (...) -- zostaw to lepiej
local h = dbQuery ( SQL_HANDLER ,...)
local result , numrows = dbPoll ( h ,- 1 )
return numrows
end
addEventHandler ( "onResourceStart" , getResourceRootElement ( getThisResource ()), onConnect )
[ Dodano : 2016-11-19, 23:22 ]
Nie
Wysłany: 2016-11-20, 00:05
nanKy
Wiek: 22 Na forum: 3865 dni Posty: 498
Nick w MP: nanky
Piwa : 1773
macieq. ,
dodaj to do mety w og-db
<export function="getRekord" type="server"/>
<export function="setRekord" type="server"/>
Wysłany: 2016-11-20, 12:30
Pawel5321
Szkrypter
Wiek: 36 Na forum: 3809 dni Posty: 237
Nick w MP: Pawell
Piwa : 2315
macieq. , chodzi?o o plik meta.xml
Tagi: login :: effect
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: