Jump to content

Stats gui


BorderLine

Recommended Posts

i was making with a friend a gui to show some players stats

but i have some problems.

clientside

function setStats ( ) 
    if ( source == GUIEditor_Grid[1] ) then 
        local row, col = guiGridListGetSelectedItem ( source ) 
        if ( row and col and row ~= -1 and col ~= -1 ) then 
            local playername = guiGridListGetItemText ( source, row, col ) 
            local thePlayer = getPlayerFromName ( playername ) 
            if ( thePlayer ) then 
                local x, y, z = getElementPosition ( thePlayer ) 
                local location = getZoneName ( x, y, z )   
                local id = getElementModel( thePlayer ) 
                local tm1 = getPlayerTeam( thePlayer ) 
                local tm2 = getTeamName( tm1 ) 
        triggerServerEvent( "getUn", thePlayer) -- triggers i dont know if are wrong or i need getLocalPlayer() 
        triggerServerEvent( "getMon", thePlayer) 
        triggerServerEvent( "getSer", thePlayer) 
                guiSetText ( GUIEditor_Label[1], "Nickname : ".. playername ) 
                guiSetText ( GUIEditor_Label[2], "Location : ".. location ) 
                guiSetText ( GUIEditor_Label[3], "Money : ".. money ) 
                guiSetText ( GUIEditor_Label[4], "Skin : ".. id ) 
                guiSetText ( GUIEditor_Label[5], "Serial : ".. theSerial ) 
                guiSetText ( GUIEditor_Label[6], "Team : ".. tm2 ) 
                guiSetText ( GUIEditor_Label[7], "Username : ".. un ) 
                     
            end 
        end 
    end 
end 
addEventHandler ( "onClientGUIDoubleClick", root, setStats ) 

serverside

function getUN() 
local un = getAccountName ( source ) 
end 
addEvent("getUN", true) 
addEventHandler("getUN", getRootElement(), getUN) 
  
function getMon() 
local money = getPlayerMoney(source)  
end 
addEvent("getMon", true) 
addEventHandler("getMon", getRootElement(), getMon) 
  
function getSer() 
local theSerial = getPlayerSerial( source ) 
end 
addEvent("getSer", true) 
addEventHandler("getSer", getRootElement(), getSer) 

i hope you can understand me and thanks for your time

and oh. debugscript dont show message

Link to comment
player argument "thePlayer" is serverside only. use localPlayer

Maybe better read wiki?

He get player element via function

getPlayerFromName 

Yakuza.Real

Not defined Variables: money, theSerial, un.

You should trigger to server -> get serial, money, ... -> trigger this data to client ->

guiSetText 

Link to comment

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