Jump to content

Profile System problem.


WolfPire

Recommended Posts

Posted
--------------------------- 
-- 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 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
--------------------------- 
-- 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 =)

~ WolfPire ~

''Overcome your own limits ~''

日本語もできますよ!

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • MTA Team
Posted

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.

Posted
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.

~ WolfPire ~

''Overcome your own limits ~''

日本語もできますよ!

  • MTA Team
Posted

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? :P

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...