WolfPire Posted March 17, 2012 Posted March 17, 2012 So guys, i'm creating a profile system which will store data of the player, however i'm having problems getting the player's account. It is associated to other resources so here's where it is. _______________________________________________________________________________________________________ Login System (Server) addEvent("register",true) addEventHandler("register",getRootElement(), function(thePlayer, NameR, PassR, Confirm) if not (NameR == "") then if not (PassR == "") then if not (Confirm == "") then if PassR == Confirm then local account = getAccount (NameR,PassR) if (account == false) then local accountAdded = addAccount(tostring">tostring">tostring">tostring">tostring(NameR),tostring">tostring">tostring(PassR)) if (accountAdded) then outputChatBox ("You've successfully registred! [Name: " .. NameR .. "| Password: " .. PassR .. "]",thePlayer,0,255,0,true ) local time = getRealTime() hours = time.hour minutes = time.minute day = time.monthday month = time.month year = time.year sincehours = hours sinceminutes = minutes sinceday = day sincemonth = month sinceyear = year setAccountData( getPlayerAccount ( thePlayer ), "player.member", sincehours) setAccountData( getPlayerAccount ( thePlayer ), "player.member", sinceminutes) setAccountData( getPlayerAccount ( thePlayer ), "player.member", sinceday) setAccountData( getPlayerAccount ( thePlayer ), "player.member", sincemonth) setAccountData( getPlayerAccount ( thePlayer ), "player.member", sinceyear) setTimer(outputChatBox,800,1,"Try to login now! Remember this information to login!",thePlayer,0,255,0,true ) else outputChatBox ("ERROR: Please use another Name/Password.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: A player with that name already exist.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: The passwords don't match.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: Please confirm your password.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: Please put a password.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: Please put a name.",thePlayer,255,0,0,true) end end ) _______________________________________________________________________________________________________ Freeroam (client) --------------------------- -- Profile --------------------------- ProfileW = guiCreateWindow(497,155,345,471,"",false) ProfileN = guiCreateLabel(16,114,300,16,"Name:",false,ProfileW) ProfileMS = guiCreateLabel(16,139,300,16,"Member Since: ",false,ProfileW) Line1 = guiCreateLabel(14,162,317,18,"_____________________________________________",false,ProfileW) guiLabelSetColor(Line1,0,255,0) ProfileK = guiCreateLabel(16,190,300,16,"Kills:",false,ProfileW) ProfileHS = guiCreateLabel(38,215,300,16,"Headshots: ",false,ProfileW) ProfileD = guiCreateLabel(16,239,300,16,"Deaths: ",false,ProfileW) ProfileT = guiCreateLabel(16,294,300,16,"Team: ",false,ProfileW) Line2 = guiCreateLabel(14,264,317,18,"_____________________________________________",false,ProfileW) guiLabelSetColor(Line2,0,255,0) Exp = guiCreateLabel(16,322,300,16,"Experience: ",false,ProfileW) ButtonPX = guiCreateButton(273,435,63,26,"X",false,ProfileW) guiWindowSetSizable(ProfileW,false) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(ProfileW,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(ProfileW,x,y,false) guiSetVisible(ProfileW, false) function nProfile() if guiGetVisible(ProfileW) == true then guiSetVisible(ProfileW, false) removeEventHandler("onClientRender", root, Data) removeEventHandler("onClientGUIClick", ButtonPX, closeManualP) else guiSetVisible(ProfileW, true) addEventHandler("onClientRender", root, Data) addEventHandler("onClientGUIClick", ButtonPX, closeManualP) end end function closeManualP() guiSetVisible(ProfileW, false) removeEventHandler("onClientRender", root, Data) end function Data() triggerServerEvent("DataS", root, localPlayer) end addEvent("DataC",true) addEventHandler("DataC", root, function( sincehoursT, sinceminutesT, sincedayT, sincemonthT, sinceyearT, exppoints, exppoints ) guiSetText(ProfileMS, "Member Since: " .. sincedayT .. " / " .. sincemonthT .. " / " .. sinceyearT .. " | " .. sincehoursT .. ":" .. sinceminutesT ) guiSetText(Exp, "Experience: " .. exppoints) end ) _______________________________________________________________________________________________________ Freeroam (Server) addEvent("DataS",true) addEventHandler("DataS",root, function(thePlayer) pAccount = getPlayerAccount ( thePlayer ) getAccountData( pAccount, "player.member" ) sincehours = sincehoursT sinceminutes = sinceminutesT sinceday = sincedayT sincemonth = sincemonthT sinceyear = sinceyearT exppoints = exports.exp:addPlayerEXP(thePlayer,5) triggerClientEvent("DataC", root, sincehoursT, sinceminutesT, sincedayT, sincemonthT, sinceyearT, exppoints) end ) _______________________________________________________________________________________________________ Console outputs: "[2012-03-17 14:17:29] WARNING: freeroam\fr_server.lua:528: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil] [2012-03-17 14:17:29] WARNING: freeroam\fr_server.lua:528: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean]" _______________________________________________________________________________________________________ Debug outputs: "ERROR: freeroam/fr_client.lua:795: attempt to concatenate local 'sinceminutesT' (a nil value)" <--- I know this is obvious _______________________________________________________________________________________________________ I'm also using "Castillos" experience resource... Yes... The script is not all done, i will finish the rest later, but is this, which is being a pain. The problem as obvious as it looks is that the "Member Since" wont render as it has a problem on getting the player's account and i find no solution for this. Please, help! >_< ~ WolfPire ~ ''Overcome your own limits ~'' 日本語もできますよ!
Castillo Posted March 17, 2012 Posted March 17, 2012 You're triggering a server side event onClientRender? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
WolfPire Posted March 17, 2012 Author Posted March 17, 2012 You're triggering a server side event onClientRender? Yes, to get real time stats, i'm willing to add many things in there. that's why. ~ WolfPire ~ ''Overcome your own limits ~'' 日本語もできますよ!
bandi94 Posted March 17, 2012 Posted March 17, 2012 i never tryed that but i think that will be a bit laggy Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
WolfPire Posted March 17, 2012 Author Posted March 17, 2012 i never tryed that but i think that will be a bit laggy Don't worry, it wont... However right now i'm realizing that it's not necessary to render all. so maybe i'll make a change after i fix this "Member since" problem. ~ WolfPire ~ ''Overcome your own limits ~'' 日本語もできますよ!
Castillo Posted March 17, 2012 Posted March 17, 2012 Triggering a server side event on each render is really bad. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
WolfPire Posted March 17, 2012 Author Posted March 17, 2012 Triggering a server side event on each render is really bad. I will use another way to update the guiLabel but, then... How will i use "getAccountData"? and how do i fix the error? ~ WolfPire ~ ''Overcome your own limits ~'' 日本語もできますよ!
Castillo Posted March 17, 2012 Posted March 17, 2012 I've tried the script and it doesn't output these errors: "[2012-03-17 14:17:29] WARNING: freeroam\fr_server.lua:528: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil][2012-03-17 14:17:29] WARNING: freeroam\fr_server.lua:528: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean]" San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
WolfPire Posted March 17, 2012 Author Posted March 17, 2012 I've tried the script and it doesn't output these errors:"[2012-03-17 14:17:29] WARNING: freeroam\fr_server.lua:528: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil][2012-03-17 14:17:29] WARNING: freeroam\fr_server.lua:528: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean]" Those errors come from console, you checked in there? EDIT: Oh yeah, it appears once you pop up the Profile window from FR ~ WolfPire ~ ''Overcome your own limits ~'' 日本語もできますよ!
Castillo Posted March 17, 2012 Posted March 17, 2012 No, they should have appeared when I executed "Data" function. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
WolfPire Posted March 17, 2012 Author Posted March 17, 2012 No, they should have appeared when I executed "Data" function. "addEventHandler("onClientRender", root, Data)" Is added when the label "My profile" is clicked in the FR GUI. There is when the errors appear and when it renders the "triggerServerEvent". That's why they don't ~ WolfPire ~ ''Overcome your own limits ~'' 日本語もできますよ!
Castillo Posted March 17, 2012 Posted March 17, 2012 Trigger it only once, and see if it output's these errors. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
WolfPire Posted March 17, 2012 Author Posted March 17, 2012 Trigger it only once, and see if it output's these errors. Better but.. "[2012-03-17 14:17:29] WARNING: freeroam\fr_server.lua:528: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil] [2012-03-17 14:17:29] WARNING: freeroam\fr_server.lua:528: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean]" ~ WolfPire ~ ''Overcome your own limits ~'' 日本語もできますよ!
Castillo Posted March 17, 2012 Posted March 17, 2012 Remove "root" from this: triggerServerEvent("DataS", root, localPlayer) and remove "thePlayer" on the server side and use 'source' as player element. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
WolfPire Posted March 17, 2012 Author Posted March 17, 2012 Remove "root" from this: triggerServerEvent("DataS", root, localPlayer) and remove "thePlayer" on the server side and use 'source' as player element. well this is how it ended up after some testing... FR Client --------------------------- -- Profile --------------------------- ProfileW = guiCreateWindow(497,155,345,471,"",false) ProfileN = guiCreateLabel(16,114,300,16,"Name:",false,ProfileW) ProfileMS = guiCreateLabel(16,139,300,16,"Member Since: ",false,ProfileW) Line1 = guiCreateLabel(14,162,317,18,"_____________________________________________",false,ProfileW) guiLabelSetColor(Line1,0,255,0) ProfileK = guiCreateLabel(16,190,300,16,"Kills:",false,ProfileW) ProfileHS = guiCreateLabel(38,215,300,16,"Headshots: ",false,ProfileW) ProfileD = guiCreateLabel(16,239,300,16,"Deaths: ",false,ProfileW) ProfileT = guiCreateLabel(16,294,300,16,"Team: ",false,ProfileW) Line2 = guiCreateLabel(14,264,317,18,"_____________________________________________",false,ProfileW) guiLabelSetColor(Line2,0,255,0) Exp = guiCreateLabel(16,322,300,16,"Experience: ",false,ProfileW) ButtonPX = guiCreateButton(273,435,63,26,"X",false,ProfileW) guiWindowSetSizable(ProfileW,false) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(ProfileW,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(ProfileW,x,y,false) guiSetVisible(ProfileW, false) function nProfile() if guiGetVisible(ProfileW) == true then guiSetVisible(ProfileW, false) removeEventHandler("onClientGUIClick", ButtonPX, closeManualP) else guiSetVisible(ProfileW, true) setTimer(Data,1000,1) addEventHandler("onClientGUIClick", ButtonPX, closeManualP) end end function closeManualP() guiSetVisible(ProfileW, false) removeEventHandler("onClientRender", root, Data) end function Data() triggerServerEvent("DataS", root, localPlayer) end addEvent("DataC",true) addEventHandler("DataC", root, function( sincehoursT, sinceminutesT, sincedayT, sincemonthT, sinceyearT, exppoints, exppoints ) guiSetText(ProfileMS, "Member Since: " .. sincedayT .. " / " .. sincemonthT .. " / " .. sinceyearT .. " | " .. sincehoursT .. ":" .. sinceminutesT ) guiSetText(Exp, "Experience: " .. exppoints) end ) FR Server addEvent("DataS",true) addEventHandler("DataS",root, function(localPlayer) pAccount = getPlayerAccount ( localPlayer ) getAccountData( pAccount, "player.member" ) sincehours = sincehoursT sinceminutes = sinceminutesT sinceday = sincedayT sincemonth = sincemonthT sinceyear = sinceyearT exppoints = exports.exp:addPlayerEXP(localPlayer,5) triggerClientEvent("DataC", root, sincehoursT, sinceminutesT, sincedayT, sincemonthT, sinceyearT, exppoints) end ) ___________________________________ No errors, except one in the debug that says: "ERROR: freeroam/fr_client.lua:794: attempt to concatenate local 'sinceminutesT' (a nil value)" For some reason the account data doesn't retrieve. ~ WolfPire ~ ''Overcome your own limits ~'' 日本語もできますよ!
Castillo Posted March 17, 2012 Posted March 17, 2012 Is that a joke or something? you changed the server side to client side and vice versa, that make's no sense. addEvent("DataS",true) addEventHandler("DataS",root, function() pAccount = getPlayerAccount ( source ) getAccountData( pAccount, "player.member" ) sincehours = sincehoursT sinceminutes = sinceminutesT sinceday = sincedayT sincemonth = sincemonthT sinceyear = sinceyearT exppoints = exports.exp:getPlayerEXP( source ) triggerClientEvent( source, "DataC", source, sincehoursT, sinceminutesT, sincedayT, sincemonthT, sinceyearT, exppoints) end ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
WolfPire Posted March 17, 2012 Author Posted March 17, 2012 Is that a joke or something? you changed the server side to client side and vice versa, that make's no sense. addEvent("DataS",true) addEventHandler("DataS",root, function() pAccount = getPlayerAccount ( source ) getAccountData( pAccount, "player.member" ) sincehours = sincehoursT sinceminutes = sinceminutesT sinceday = sincedayT sincemonth = sincemonthT sinceyear = sinceyearT exppoints = exports.exp:getPlayerEXP( source ) triggerClientEvent( source, "DataC", source, sincehoursT, sinceminutesT, sincedayT, sincemonthT, sinceyearT, exppoints) end ) Believe it or not, localPlayer can also be used server-side if you do it the correct way ~ WolfPire ~ ''Overcome your own limits ~'' 日本語もできますよ!
Castillo Posted March 17, 2012 Posted March 17, 2012 localPlayer is client side only: https://wiki.multitheftauto.com/wiki/GetLocalPlayer You can trigger the variable to the server side, but it won't be 'localPlayer'. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
WolfPire Posted March 17, 2012 Author Posted March 17, 2012 Btw... Same error of the concatenate thing. ~ WolfPire ~ ''Overcome your own limits ~'' 日本語もできますよ!
Castillo Posted March 17, 2012 Posted March 17, 2012 That's because you haven't declared the variables: sincehours = sincehoursT sinceminutes = sinceminutesT sinceday = sincedayT sincemonth = sincemonthT sinceyear = sinceyearT What is: sincehoursT sinceminutesT sincedayT sincemonthT sinceyearT San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
WolfPire Posted March 17, 2012 Author Posted March 17, 2012 addEvent("register",true) addEventHandler("register",getRootElement(), function(thePlayer, NameR, PassR, Confirm) if not (NameR == "") then if not (PassR == "") then if not (Confirm == "") then if PassR == Confirm then local account = getAccount (NameR,PassR) if (account == false) then local accountAdded = addAccount(tostring">tostring">tostring">tostring">tostring">tostring(NameR),tostring">tostring">tostring">tostring(PassR)) if (accountAdded) then outputChatBox ("You've successfully registred! [Name: " .. NameR .. "| Password: " .. PassR .. "]",thePlayer,0,255,0,true ) local time = getRealTime() hours = time.hour minutes = time.minute day = time.monthday month = time.month year = time.year sincehours = hours sinceminutes = minutes sinceday = day sincemonth = month sinceyear = year setAccountData( getPlayerAccount ( thePlayer ), "player.member", sincehours) setAccountData( getPlayerAccount ( thePlayer ), "player.member", sinceminutes) setAccountData( getPlayerAccount ( thePlayer ), "player.member", sinceday) setAccountData( getPlayerAccount ( thePlayer ), "player.member", sincemonth) setAccountData( getPlayerAccount ( thePlayer ), "player.member", sinceyear) setTimer(outputChatBox,800,1,"Try to login now! Remember this information to login!",thePlayer,0,255,0,true ) else outputChatBox ("ERROR: Please use another Name/Password.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: A player with that name already exist.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: The passwords don't match.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: Please confirm your password.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: Please put a password.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: Please put a name.",thePlayer,255,0,0,true) end end ) Defined in the login system (server) stored data. so i don't see where's the error tho. ~ WolfPire ~ ''Overcome your own limits ~'' 日本語もできますよ!
Castillo Posted March 17, 2012 Posted March 17, 2012 1: You're saving hours, minutes, seconds, etc on the same account data value, is not a table. 2: You're using getAccountData, but you don't do something like: hours = getAccountData ( pAccount, "player.member" ). 3: I suggest you to save the time on a string. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
WolfPire Posted March 17, 2012 Author Posted March 17, 2012 1: You're saving hours, minutes, seconds, etc on the same account data value, is not a table.2: You're using getAccountData, but you don't do something like: hours = getAccountData ( pAccount, "player.member" ). 3: I suggest you to save the time on a string. 1. Done 2. Done 3. How? A. Need the code? EDIT: ERROR: freeroam/fr_client.lua:794: attempt to concatenate local "sinceminutes" (a boolean value) Fr Server addEvent("DataS",true) addEventHandler("DataS",root, function() pAccount = getPlayerAccount ( source ) sincehours = getAccountData( pAccount, "player.memberho" ) sinceminutes = getAccountData( pAccount, "player.membermi" ) sinceday = getAccountData( pAccount, "player.memberda" ) sincemonth = getAccountData( pAccount, "player.membermo" ) sinceyear = getAccountData( pAccount, "player.memberye" ) exppoints = exports.exp:getPlayerEXP( source ) triggerClientEvent( source, "DataC", source, sincehours, sinceminutes, sinceday, sincemonth, sinceyear, exppoints) end ) Fr Client --------------------------- -- Profile --------------------------- ProfileW = guiCreateWindow(497,155,345,471,"",false) ProfileN = guiCreateLabel(16,114,300,16,"Name:",false,ProfileW) ProfileMS = guiCreateLabel(16,139,300,16,"Member Since: ",false,ProfileW) Line1 = guiCreateLabel(14,162,317,18,"_____________________________________________",false,ProfileW) guiLabelSetColor(Line1,0,255,0) ProfileK = guiCreateLabel(16,190,300,16,"Kills:",false,ProfileW) ProfileHS = guiCreateLabel(38,215,300,16,"Headshots: ",false,ProfileW) ProfileD = guiCreateLabel(16,239,300,16,"Deaths: ",false,ProfileW) ProfileT = guiCreateLabel(16,294,300,16,"Team: ",false,ProfileW) Line2 = guiCreateLabel(14,264,317,18,"_____________________________________________",false,ProfileW) guiLabelSetColor(Line2,0,255,0) Exp = guiCreateLabel(16,322,300,16,"Experience: ",false,ProfileW) ButtonPX = guiCreateButton(273,435,63,26,"X",false,ProfileW) guiWindowSetSizable(ProfileW,false) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(ProfileW,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(ProfileW,x,y,false) guiSetVisible(ProfileW, false) function nProfile() if guiGetVisible(ProfileW) == true then guiSetVisible(ProfileW, false) removeEventHandler("onClientGUIClick", ButtonPX, closeManualP) else guiSetVisible(ProfileW, true) setTimer(Data,1000,1) addEventHandler("onClientGUIClick", ButtonPX, closeManualP) end end function closeManualP() guiSetVisible(ProfileW, false) removeEventHandler("onClientRender", root, Data) end function Data() triggerServerEvent("DataS", root) end addEvent("DataC",true) addEventHandler("DataC", root, function( sincehours, sinceminutes, sinceday, sincemonth, sinceyear, exppoints ) guiSetText(ProfileMS, "Member Since: " .. sinceday .. " / " .. sincemonth .. " / " .. sinceyear .. " | " .. sincehours .. ":" .. sinceminutes .. "" ) guiSetText(Exp, "Experience: " .. exppoints) end ) Login System (server) addEvent("register",true) addEventHandler("register",getRootElement(), function(thePlayer, NameR, PassR, Confirm) if not (NameR == "") then if not (PassR == "") then if not (Confirm == "") then if PassR == Confirm then local account = getAccount (NameR,PassR) if (account == false) then local accountAdded = addAccount(tostring">tostring(NameR),tostring">tostring(PassR)) if (accountAdded) then outputChatBox ("You've successfully registred! [Name: " .. NameR .. "| Password: " .. PassR .. "]",thePlayer,0,255,0,true ) local time = getRealTime() sincehours = time.hour sinceminutes = time.minute sinceday = time.monthday sincemonth = time.month sinceyear = time.year setAccountData( getPlayerAccount ( thePlayer ), "player.memberho", sincehours) setAccountData( getPlayerAccount ( thePlayer ), "player.membermi", sinceminutes) setAccountData( getPlayerAccount ( thePlayer ), "player.memberda", sinceday) setAccountData( getPlayerAccount ( thePlayer ), "player.membermo", sincemonth) setAccountData( getPlayerAccount ( thePlayer ), "player.memberye", sinceyear) setTimer(outputChatBox,800,1,"Try to login now! Remember this information to login!",thePlayer,0,255,0,true ) else outputChatBox ("ERROR: Please use another Name/Password.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: A player with that name already exist.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: The passwords don't match.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: Please confirm your password.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: Please put a password.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: Please put a name.",thePlayer,255,0,0,true) end end ) ~ WolfPire ~ ''Overcome your own limits ~'' 日本語もできますよ!
Castillo Posted March 17, 2012 Posted March 17, 2012 addEvent("register",true) addEventHandler("register",getRootElement(), function(thePlayer, NameR, PassR, Confirm) if not (NameR == "") then if not (PassR == "") then if not (Confirm == "") then if PassR == Confirm then local account = getAccount (NameR,PassR) if (account == false) then local accountAdded = addAccount(tostring(NameR),tostring(PassR)) if (accountAdded) then outputChatBox ("You've successfully registred! [Name: " .. NameR .. "| Password: " .. PassR .. "]",thePlayer,0,255,0,true ) local realTime = getRealTime() local rTime = string.format("%02d:%02d", realTime.hour, realTime.minute ) local rDate = string.format("%04d/%02d/%02d", realTime.year + 1900, realTime.month + 1, realTime.monthday ) setAccountData( accountAdded, "player.member", rDate .." - ".. rTime) setTimer(outputChatBox,800,1,"Try to login now! Remember this information to login!",thePlayer,0,255,0,true ) else outputChatBox ("ERROR: Please use another Name/Password.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: A player with that name already exist.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: The passwords don't match.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: Please confirm your password.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: Please put a password.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: Please put a name.",thePlayer,255,0,0,true) end end ) addEvent("DataS",true) addEventHandler("DataS",root, function() local pAccount = getPlayerAccount ( source ) local joinedOn = getAccountData( pAccount, "player.member" ) exppoints = exports.exp:getPlayerEXP( source ) triggerClientEvent( source, "DataC", source, joinedOn ) end ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
WolfPire Posted March 18, 2012 Author Posted March 18, 2012 addEvent("register",true) addEventHandler("register",getRootElement(), function(thePlayer, NameR, PassR, Confirm) if not (NameR == "") then if not (PassR == "") then if not (Confirm == "") then if PassR == Confirm then local account = getAccount (NameR,PassR) if (account == false) then local accountAdded = addAccount(tostring(NameR),tostring(PassR)) if (accountAdded) then outputChatBox ("You've successfully registred! [Name: " .. NameR .. "| Password: " .. PassR .. "]",thePlayer,0,255,0,true ) local realTime = getRealTime() local rTime = string.format("%02d:%02d", realTime.hour, realTime.minute ) local rDate = string.format("%04d/%02d/%02d", realTime.year + 1900, realTime.month + 1, realTime.monthday ) setAccountData( accountAdded, "player.member", rDate .." - ".. rTime) setTimer(outputChatBox,800,1,"Try to login now! Remember this information to login!",thePlayer,0,255,0,true ) else outputChatBox ("ERROR: Please use another Name/Password.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: A player with that name already exist.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: The passwords don't match.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: Please confirm your password.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: Please put a password.",thePlayer,255,0,0,true) end else outputChatBox ("ERROR: Please put a name.",thePlayer,255,0,0,true) end end ) addEvent("DataS",true) addEventHandler("DataS",root, function() local pAccount = getPlayerAccount ( source ) local joinedOn = getAccountData( pAccount, "player.member" ) exppoints = exports.exp:getPlayerEXP( source ) triggerClientEvent( source, "DataC", source, joinedOn ) end ) What about client? ~ WolfPire ~ ''Overcome your own limits ~'' 日本語もできますよ!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now