Jump to content

Stats gui


BorderLine

Recommended Posts

Posted

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

Actual Nick: [XGN]BorderLine

Actual Clan: XLatino

Actual Status: Staff, Mod Level 1

(BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline

Posted
triggerServerEvent("getUn",getLocalPlayer()) 
--Error 
 triggerServerEvent( "getUn", thePlayer) 

╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗

║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║

║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║

║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║

╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝

«سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك»

M7mdAl7arthy : لتواصل سكايب

Posted
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 

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

sounds dificult :S, well thanks kenix, ill see what i can do

Actual Nick: [XGN]BorderLine

Actual Clan: XLatino

Actual Status: Staff, Mod Level 1

(BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline

Posted

If you want to fix your code

send all client code

تذكر عند تصفحك للأنترنت قوله تعالى: (( وهو معكم أين ما كنتم والله بما تعملون بصير )) ا

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