Castillo Posted March 18, 2012 Share Posted March 18, 2012 --------------------------- -- 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", localPlayer) end addEvent("DataC",true) addEventHandler("DataC", root, function( joinedOn, exppoints ) guiSetText ( ProfileMS, "Member Since: " .. joinedOn ) guiSetText ( Exp, "Experience: ".. exppoints or 0 ) end ) addEvent("DataS",true) addEventHandler("DataS",root, function() local pAccount = getPlayerAccount ( source ) local joinedOn = getAccountData( pAccount, "player.member" ) local exppoints = exports.exp:getPlayerEXP( source ) triggerClientEvent( source, "DataC", source, joinedOn, exppoints ) end ) Link to comment
WolfPire Posted March 18, 2012 Author Share Posted March 18, 2012 --------------------------- -- 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", localPlayer) end addEvent("DataC",true) addEventHandler("DataC", root, function( joinedOn, exppoints ) guiSetText ( ProfileMS, "Member Since: " .. joinedOn ) guiSetText ( Exp, "Experience: ".. exppoints or 0 ) end ) addEvent("DataS",true) addEventHandler("DataS",root, function() local pAccount = getPlayerAccount ( source ) local joinedOn = getAccountData( pAccount, "player.member" ) local exppoints = exports.exp:getPlayerEXP( source ) triggerClientEvent( source, "DataC", source, joinedOn, exppoints ) end ) I shall kiss you, ok no lol. Thanks again, solid =) Link to comment
qaisjp Posted March 18, 2012 Share Posted March 18, 2012 I didn't read all the posts, but I recommend you to just save and load the account date when a person leaves / joins, and use element data during the server. That way, on the client ON RENDER you can use getElementData which won't be much of a problem. (So onPlayerLogin, you getAccountData and set the element data of the player. Then to get or set the profile attribute, just use setElementData and getElementData, and when the player leaves, use setAccountData) I'm sure Solidsnake14 can provide such code. Link to comment
WolfPire Posted March 18, 2012 Author Share Posted March 18, 2012 I didn't read all the posts, but I recommend you to just save and load the account date when a person leaves / joins, and use element data during the server. That way, on the client ON RENDER you can use getElementData which won't be much of a problem.(So onPlayerLogin, you getAccountData and set the element data of the player. Then to get or set the profile attribute, just use setElementData and getElementData, and when the player leaves, use setAccountData) I'm sure Solidsnake14 can provide such code. Thanks, suggestion accepted. Link to comment
qaisjp Posted March 19, 2012 Share Posted March 19, 2012 Here is example: SERVER: addEventHandler('onPlayerLogin', root, function(a) local gay = tonumber( getAccountData( a,'gayplayer' ) ) setElementData( source, 'gayplayer',gay or 0, true) end) addCommandHandler('gay', function() local gay = getElementData(source,'gay') setElementData(source, 'gayplayer', gay==0 and 1 or 0, true) end) addEventHandler('onPlayerQuit', root, function() local a = getPlayerAccount(source) local gay = getElementData(source,'gay') and '1' or '0' if not isGuestAccount(a) then setAccountData(a,'gayplayer',gay) end end) and client: addEventHandler('onClientRender', root, function() if getElementData(localPlayer, 'gayplayer') == 1 then outputChatBox('GAY!!!!') end end) k understood? Link to comment
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