Wysłany: 2011-09-20, 20:49
dida
Wiek: 30 Na forum: 5633 dni Posty: 76
Piwa : 1
Robie system postaci i tu **** znikow?d.
ss konsoli http://www.fototube.pl/zd...7-badnagtao.png
kod
Kod:
function onreghandler(thePlayer)
local konto = getPlayerAccount ( thePlayer )
local wolnyslot = "Wolny Slot"
setAccountData ( konto, "postac11", tostring(wolnyslot))
setAccountData ( konto, "postac22", tostring(wolnyslot))
setAccountData ( konto, "postac33", tostring(wolnyslot))
setAccountData ( konto, "postac44", tostring(wolnyslot))
end
Wysłany: 2011-09-20, 22:09
Piorun
Wiek: 32 Na forum: 6712 dni Posty: 1837
Nick w MP: Piorun
Piwa : 516
T? funkcj? masz podpi?t? pod co? (zdarzenie lub komenda)?
@EDIT
Funkcje tostring nie s? potrzebne.
Wysłany: 2011-09-21, 08:10
dida
Wiek: 30 Na forum: 5633 dni Posty: 76
Piwa : 1
ta pod gui sa podpiete znaczy sie nie ze podpiete tylko potem jest wczytywane przez getAccountData do gui a i bez tostring to samo
Wysłany: 2011-09-21, 18:09
Piorun
Wiek: 32 Na forum: 6712 dni Posty: 1837
Nick w MP: Piorun
Piwa : 516
Poka? ca?y kod (strona klienta i serwera), bo chyba wiem ocb., lecz jednak chcia?bym zerkn?? na kod.
Wysłany: 2011-09-22, 08:06
dida
Wiek: 30 Na forum: 5633 dni Posty: 76
Piwa : 1
Client:
Kod: function serverExample(postac111,postac222,postac333,postac444)
createPostacWindow()
guiSetText(postac1slot,tostring(postac111))
guiSetText(postac2slot,tostring(postac222))
guiSetText(postac3slot,tostring(postac333))
guiSetText(postac4slot,tostring(postac444))
end
addEvent("omoze", true)
addEventHandler("omoze", getRootElement(), serverExample)
Server:
Kod:
function loginHandler(player, username, password,nazw)
local account = getAccount(username, password, nazw)
local konto = getPlayerAccount ( source )
if (account ~= false) then
if (logIn(player, account, password, nazw) == true) then
triggerClientEvent (player, "postac", getRootElement())
triggerClientEvent (player, "hideLoginWindow", getRootElement())
local playeraccount = getPlayerAccount ( player )
local postac111 = getAccountData ( playeraccount, "postac11" )
local postac222 = getAccountData ( playeraccount, "postac22" )
local postac333 = getAccountData ( playeraccount, "postac33" )
local postac444 = getAccountData ( playeraccount, "postac44" )
triggerClientEvent(player, "omoze",getRootElement(),postac111,postac222,postac333,postac444)
else
triggerClientEvent (player, "unknownError", getRootElement())
end
else
triggerClientEvent (player, "loginWrong", getRootElement())
end
end
function registerHandler(player, username, password,nazw)
local account = getAccount(username, password)
if (account ~= false) then
triggerClientEvent(player, "registerTaken", getRootElement())
else
account = addAccount(username, password)
if (logIn(player, account, password) == true) then
test()
triggerClientEvent(player, "hideLoginWindow",getRootElement())
triggerClientEvent(player, "postac",getRootElement())
local playeracc1 = getPlayerAccount ( player )
local postac111 = getAccountData (playeracc1, "postacp" )
local postac222 = getAccountData (playeracc1, "postacd" )
local postac333 = getAccountData (playeracc1, "postact" )
local postac444 = getAccountData (playeracc1, "postaccz" )
triggerClientEvent(player, "omoze",getRootElement(),postac111,postac222,postac333,postac444)
else
triggerClientEvent(player, "unknownError", getRootElement())
end
end
end
function test(player)
local playeracc2 = getPlayerAccount ( player )
setAccountData(playeracc2, "postacp", "Wolny slot pierwszy")
setAccountData(playeracc2, "postacd", "Wolny slot drugi")
setAccountData(playeracc2, "postact", "Wolny slot trzeci")
setAccountData(playeracc2, "postaccz", "Wolny slot czwarty")
setAccountData(playeracc2, "postacppraca", "Kierowca ci??ar?wki")
setAccountData(playeracc2, "postacdpraca", "Kierowca ci??ar?wki")
setAccountData(playeracc2, "postactpraca", "Kierowca ci??ar?wki")
setAccountData(playeracc2, "postacczpraca", "Kierowca ci??ar?wki")
end
Wysłany: 2011-09-22, 15:57
Piorun
Wiek: 32 Na forum: 6712 dni Posty: 1837
Nick w MP: Piorun
Piwa : 516
Nom ok - to teraz mi powiedz pod co jest podpi?ta funkcja loginHandler - zdarzenie, czy komend??
Wysłany: 2011-09-22, 16:57
dida
Wiek: 30 Na forum: 5633 dni Posty: 76
Piwa : 1
Wysłany: 2011-09-22, 17:27
Piorun
Wiek: 32 Na forum: 6712 dni Posty: 1837
Nick w MP: Piorun
Piwa : 516
To w takim razie nie masz poj?cia o ??czeniu stron. Ja bym Ci proponowa? na pocz?tku pobawi? si? stronami za pomoc? zmiennych liczbowych, a dopiero potem bawi? si? w GUI.
Tagi: proble* :: setaccountdata
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: