Jump to content

need help.


sckatchof

Recommended Posts

hi guys i have probelm when i select a player from gridlist nothing it show in labels this is my script

client side :

function info ( ) 
    local row = guiGridListGetSelectedItem ( GridListePlayer ) 
    playername = guiGridListGetItemText ( GridListePlayer, row, 1) 
    playerip = getPlayerIP ( localPlayer ) 
    playerSerial = getPlayerSerial() 
    accountname = getAccountName() 
    guiSetText ( LabelName, "Name : " .. playername .. " " ) 
    guiSetText ( LabelIp, "IP : " ..playerip .." " ) 
    guiSetText ( LabelSerial, "Serial : " ..tostring(playerSerial) .." " ) 
    guiSetText ( LabelAccountName, "Account Name : " ..accountname .." " ) 
        triggerServerEvent ( "ListInfo", localPlayer, playername, playerip, playerSerial, accountname ) 
end 

Server Side :

addEvent ( "ListInfo", true ) 
addEventHandler ( "ListInfo", root, 
    function ( playerName ) 
        local thePlayer = getPlayerFromName ( playerName ) 
        local theIp = getPlayerIP ( playerName ) 
        local theSerial = getPlayerSerial( playerName ) 
        local theAccountName = getPlayerSerial( playerName ) 
    end 
) 
  

Link to comment

Script needs admin rights. Also:

Client-side:

function info ( ) 
    local row = guiGridListGetSelectedItem ( GridListePlayer ) 
    playername = guiGridListGetItemText ( GridListePlayer, row, 1) 
    playerip = getPlayerIP ( localPlayer ) 
    playerSerial = getPlayerSerial() 
    accountname = getAccountName() 
    guiSetText ( LabelName, "Name : " .. playername .. " " ) 
    guiSetText ( LabelIp, "IP : " ..playerip .." " ) 
    guiSetText ( LabelSerial, "Serial : " ..tostring(playerSerial) .." " ) 
    guiSetText ( LabelAccountName, "Account Name : " ..accountname .." " ) 
    triggerServerEvent ( "ListInfo", localPlayer, playername, playerip, playerSerial, accountname ) 
end 

Server-side:

addEvent ( "ListInfo", true ) 
addEventHandler ( "ListInfo", root, 
    function ( playerName, ip, serial, account ) 
        -- something with playerName 
        -- something with ip 
        -- something with serial 
        -- something with account 
    end 
) 

Link to comment

Fail :lol:

Client-side:

addEventHandler ( 'onClientGUIClick', root, 
    function ( ) 
        if ( source == GridListePlayer ) then 
            local row, col = guiGridListGetSelectedItem ( GridListePlayer ); 
            if ( row and col and row ~= -1 and col ~= -1 ) then 
                local playername = guiGridListGetItemText ( GridListePlayer, row, 1 ); 
                triggerServerEvent ( 'triggerData', localPlayer, row, playername ); 
            end 
        end 
    end 
) 
  
addEvent ( 'setText', true ); 
  
addEventHandler ( 'setText', root, 
    function ( player, ip, serial, account ) 
        guiSetText ( LabelName, "Name : " .. tostring(player) .. " " ); 
        guiSetText ( LabelIp, "IP : " ..tostring(ip) .." " ); 
        guiSetText ( LabelSerial, "Serial : " ..tostring(serial) .." " ); 
        guiSetText ( LabelAccountName, "Account Name : " ..tostring(account) .." " ); 
        triggerServerEvent ( 'ListInfo', localPlayer, player, ip, serial, account ); 
    end 
) 

Server-side:

addEvent ( "ListInfo", true ); 
  
addEventHandler ( "ListInfo", root, 
    function ( playerName, ip, serial, account ) 
        -- something with playerName 
        -- something with ip 
        -- something with serial 
        -- something with account 
    end 
) 
  
addEvent ( 'triggerData', true ); 
  
addEventHandler ( 'triggerData', root, 
    function ( row, player ) 
        playerip = getPlayerIP ( player ); 
        playerSerial = getPlayerSerial ( player ); 
        accountname = getAccountName ( getPlayerAccount ( player ) ); 
        triggerClientEvent ( 'setText', source, player, ip, playerSerial, accountname ); 
    end 
) 

Edited by Guest
Link to comment

sckatchof, You need check if you select player in gridlist and trigger to server ( triggerServerEvent ).

In server side you need get ip,serial,.. ( what you need ) and send to client with triggerClientEvent and set text to label.

Link to comment
sckatchof, You need check if you select player in gridlist and trigger to server ( triggerServerEvent ).

In server side you need get ip,serial,.. ( what you need ) and send to client with triggerClientEvent and set text to label.

thank you guys for help and how can i check if i select player from gridlist i try to do it but i can't :(

Link to comment

thank you guys for help and this is server side

server :

addEvent ( "ListInfo", true ); 
  
addEventHandler ( "ListInfo", root, 
    function ( playerName, ip, serial, account ) 
        -- something with playerName 
        -- something with ip 
        -- something with serial 
        -- something with account 
    end 
) 
  
addEvent ( 'triggerData', true ); 
  
addEventHandler ( 'triggerData', root, 
    function ( row, player ) 
        playerip = getPlayerIP ( player ); 
        playerSerial = getPlayerSerial ( player ); 
        accountname = getAccountName ( getPlayerAccount ( player ) ); 
        triggerClientEvent ( 'setText', source, player, ip, playerSerial, accountname ); 
    end 
) 

and what i put in that lines

-- something with playerName

-- something with ip

-- something with serial

-- something with account

this ?

        local thePlayer = getPlayerFromName ( playerName ) 
        local theIp = getPlayerIP ( playerName ) 
        local theSerial = getPlayerSerial( playerName ) 
        local theAccountName = getPlayerSerial( playerName ) 

and this client

addEventHandler ( 'onClientGUIClick', root, 
    function ( ) 
        if ( source == GridListePlayer ) then 
            local row, col = guiGridListGetSelectedItem ( GridListePlayer ); 
            if ( row and col and row ~= -1 and col ~= -1 ) then 
                local playername = guiGridListGetItemText ( GridListePlayer, row, 1 ); 
                triggerServerEvent ( 'triggerData', localPlayer, row, playername ); 
            end 
        end 
    end 
) 
  
addEvent ( 'setText', true ); 
  
addEventHandler ( 'setText', root, 
    function ( player, ip, serial, account ) 
        guiSetText ( LabelName, "Name : " .. tostring(player) .. " " ); 
        guiSetText ( LabelIp, "IP : " ..tostring(ip) .." " ); 
        guiSetText ( LabelSerial, "Serial : " ..tostring(serial) .." " ); 
        guiSetText ( LabelAccountName, "Account Name : " ..tostring(account) .." " ); 
        triggerServerEvent ( 'ListInfo', localPlayer, player, ip, serial, account ); 
    end 
) 

Link to comment

-- client side.

addEventHandler ( 'onClientGUIClick', root, 
    function ( ) 
        if ( source == GridListePlayer ) then 
            local row, col = guiGridListGetSelectedItem ( GridListePlayer ); 
            if ( row and col and row ~= -1 and col ~= -1 ) then 
                local playername = guiGridListGetItemText ( GridListePlayer, row, 1 ); 
                triggerServerEvent ( 'triggerData', localPlayer, playername ); -- Why was you triggering 'row'? 
            end 
        end 
    end 
) 
  
addEvent ( 'setText', true ); 
  
addEventHandler ( 'setText', root, 
    function ( player, ip, serial, account ) 
        guiSetText ( LabelName, "Name : " .. tostring ( player ) .. " " ); 
        guiSetText ( LabelIp, "IP : " ..tostring ( ip ) .." " ); 
        guiSetText ( LabelSerial, "Serial : " ..tostring ( serial ) .." " ); 
        guiSetText ( LabelAccountName, "Account Name : " ..tostring ( account ) .." " ); 
        triggerServerEvent ( 'ListInfo', localPlayer, player, ip, serial, account ); 
    end 
) 

-- server side:

addEvent ( "ListInfo", true ); 
  
addEventHandler ( "ListInfo", root, 
    function ( playerName, ip, serial, account ) 
        -- something with playerName 
        -- something with ip 
        -- something with serial 
        -- something with account 
    end 
) 
  
addEvent ( 'triggerData', true ); 
  
addEventHandler ( 'triggerData', root, 
    function ( playerName ) 
        local player = getPlayerFromName ( playerName ) 
        local playerip = getPlayerIP ( player ); 
        local playerSerial = getPlayerSerial ( player ); 
        local accountname = getAccountName ( getPlayerAccount ( player ) ); 
        triggerClientEvent ( source, 'setText', source, playerName, ip, playerSerial, accountname ); 
    end 
) 

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