Wysłany: 2013-09-14, 19:52
pidbulxd
Wiek: 28 Na forum: 5230 dni Posty: 135
Nick w MP: Word
Piwa : 540
Witajcie, nie b?d? owija? w bawe?n? tylko od razu przejd?, do sedna sprawy.
Mianowicie, zacze?em pracowa? nad logowaniem wraz z systemem tworzenia swojej postaci, potrzebne to b?dzie do dzia?a dw?ch innych skrypt?w ale mniejsza.
M?j problem polega na tym: Przy tworzeniu postaci, zero b??d?w w debugu. Po stworzeniu, dzia?a jak nale?y, uzupe?nia odpowiednie "editiy", tekstem.
Ale gdy zrobie "reconnecta", ju? tych danych nie ma. Prezentuje wam kod, o kt?rym napisa?em wy?ej.
Strona Client, tworzenie postaci:
function tworzepostrac ()
local imie = guiGetText ( GUIEditor . edit [ 9 ])
local nazwisko = guiGetText ( GUIEditor . edit [ 10 ])
local plec = guiGetText ( GUIEditor . combobox [ 1 ])
local wiek = guiGetText ( GUIEditor . edit [ 11 ])
if imie and nazwisko and plec and wiek then
if ( string . len ( imie )>= 4 ) then
if ( string . len ( nazwisko )>= 4 ) then
if ( string . len ( wiek )>= 1 ) then
guiSetVisible ( GUIEditor . gridlist [ 6 ], false )
guiSetVisible ( GUIEditor . gridlist [ 5 ], true )
guiSetText ( GUIEditor . edit [ 5 ], imie )
guiSetText ( GUIEditor . edit [ 6 ], nazwisko )
guiSetText ( GUIEditor . edit [ 7 ], plec )
guiSetText ( GUIEditor . edit [ 8 ], wiek )
triggerServerEvent ( "dobrzestworzona" , getLocalPlayer (), imie , nazwisko , plec , wiek )
else
exports . notifications : showBox ( "error" , "Nie poda?e? imienia." )
end
else
exports . notifications : showBox ( "error" , "Nazwisko postaci, musi zabierac ponad 4 znaki." )
end
else
exports . notifications : showBox ( "error" , "Musisz wpisa? liczbe od 0-100." )
end
end
-- exports . notifications : showBox ( "error" , "Wyszystkie pola musza by? wype?nione." )
end
addEventHandler ( "onClientGUIClick" , GUIEditor . button [ 13 ], tworzepostrac , false )
Strona Client, pobieranie danych:
function dane ( imie , nazwisko , plec , wiek )
guiSetText ( GUIEditor . edit [ 5 ], imie )
guiSetText ( GUIEditor . edit [ 6 ], nazwisko )
guiSetText ( GUIEditor . edit [ 7 ], plec )
guiSetText ( GUIEditor . edit [ 8 ], wiek )
end
addEvent ( "danep" , true )
addEventHandler ( "danep" , getRootElement (), dane )
Strona Server, tworzenie postaci:
function tworzeniepostacis ( imie , nazwisko , plec , wiek )
local konto = getPlayerAccount ( source )
if ( getAccountData ( konto , "Mampostac" )== true ) then
exports . notifications : showBox ( source , "error" , "Masz ju? posta? !" )
else
-- sql . Query ( "INSERT INTO Konto ( Login, Imie, Nazwisko, Plec, Wiek ) VALUES ( " .. login .. ", " .. Imie .. ", " .. Nazwisko .. ", " .. Plec .. ", " .. Wiek .. " '', '' )" );
local konto = getPlayerAccount ( source )
setAccountData ( konto , "Imie" , imie )
setAccountData ( konto , "Nazwisko" , nazwisko )
setAccountData ( konto , "Wiek" , wiek )
setAccountData ( konto , "P?e?" , plec )
setAccountData ( konto , "MamPostac" , true )
setElementData ( source , "Imie" , imie )
setElementData ( source , "Nazwisko" , nazwisko )
setElementData ( source , "Wiek" , wiek )
setElementData ( source , "P?e?" , plec )
exports . notifications : showBox ( source , "info" , "Pomy?lnie stworzono posta?" )
end
end
addEvent ( "dobrzestworzona" , true )
addEventHandler ( "dobrzestworzona" , getRootElement (), tworzeniepostacis )
Strona Server, pobieranie danych
function pobierzdane ( source )
local konto = getPlayerAccount ( source )
local imie = getAccountData ( konto , "Imie" )
local nazwisko = getAccountData ( konto , "Nazwisko" )
local wiek = getAccountData ( konto , "Wiek" )
local plec = getAccountData ( konto , "P?e?" )
triggerClientEvent ( source , "danep" , getRootElement (), imie , nazwisko , plec . wiek )
end
addEventHandler ( "OnPlayerLogin" , getRootElement (), pobierzdane )
Strona Server, zapis
function onPlayerQuits ()
local playeraccount = getPlayerAccount ( source )
if ( playeraccount ) then
if not isGuestAccount ( playeraccount ) then
local playerscore = getElementData ( source , "Score" )
if ( playerscore ) then
local playermoney = getPlayerMoney ( source )
local imie = getElementData ( source , "Imie" )
local naziwsko = getElementData ( source , "Naziwsko" )
local plec = getElementData ( source , "P?e?" )
local wiek = getElelemtData ( source , "Wiek" )
setAccountData ( playeraccount , "cash" , playermoney )
setAccountData ( playeraccount , "score" , playerscore )
setAccountData ( playeraccount , "Imie" , imie )
setAccountData ( playeraccount , "Nazwisko" , nazwisko )
setAccountData ( playeraccount , "Wiek" , wiek )
setAccountData ( playeraccount , "P?e?" , plec )
end
end
end
end
addEventHandler ( "onPlayerQuit" , getRootElement (), onPlayerQuits )
Prosz? o pomoc, w razie czego kontakt:
Skype: pidbulxdd
Pozdrawiam Word.
Wysłany: 2013-09-14, 19:59
vipSEBOvip
A poor begginer
Wiek: 26 Na forum: 5178 dni Posty: 597
Nick w MP: xSebaPL
Piwa : 77
Nie wiem czy dobrze my?l?, ale wielko?? liter te? chyba ma jakie? znaczenie:
function tworzeniepostacis ( imie , nazwisko , plec , wiek )
local konto = getPlayerAccount ( source )
if ( getAccountData ( konto , "MamPostac" )== true ) then
exports . notifications : showBox ( source , "error" , "Masz ju? posta? !" )
else
-- sql . Query ( "INSERT INTO Konto ( Login, Imie, Nazwisko, Plec, Wiek ) VALUES ( " .. login .. ", " .. Imie .. ", " .. Nazwisko .. ", " .. Plec .. ", " .. Wiek .. " '', '' )" );
local konto = getPlayerAccount ( source )
setAccountData ( konto , "Imie" , imie )
setAccountData ( konto , "Nazwisko" , nazwisko )
setAccountData ( konto , "Wiek" , wiek )
setAccountData ( konto , "P?e?" , plec )
setAccountData ( konto , "MamPostac" , true )
setElementData ( source , "Imie" , imie )
setElementData ( source , "Nazwisko" , nazwisko )
setElementData ( source , "Wiek" , wiek )
setElementData ( source , "P?e?" , plec )
exports . notifications : showBox ( source , "info" , "Pomy?lnie stworzono posta?" )
end
end
addEvent ( "dobrzestworzona" , true )
addEventHandler ( "dobrzestworzona" , getRootElement (), tworzeniepostacis )
Wysłany: 2013-09-15, 00:30
pidbulxd
Wiek: 28 Na forum: 5230 dni Posty: 135
Nick w MP: Word
Piwa : 540
Poradzi?em sobie sam, prosze moderatora o zamkniecie tematu
Tagi: system :: tworzenia :: postaci
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: