sckatchof Posted March 26, 2012 Share Posted March 26, 2012 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
drk Posted March 26, 2012 Share Posted March 26, 2012 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
Kenix Posted March 26, 2012 Share Posted March 26, 2012 Draken,getPlayerIP is server side Link to comment
drk Posted March 26, 2012 Share Posted March 26, 2012 (edited) Fail 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 March 26, 2012 by Guest Link to comment
Kenix Posted March 26, 2012 Share Posted March 26, 2012 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 Posted March 26, 2012 Author Share Posted March 26, 2012 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
Castillo Posted March 26, 2012 Share Posted March 26, 2012 I use this: local row, col = guiGridListGetSelectedItem ( yourGridListElement ) if ( row and col and row ~= -1 and col ~= -1 ) then --Your code here end Link to comment
drk Posted March 26, 2012 Share Posted March 26, 2012 That's what I put in my code. Next time see posts first Link to comment
sckatchof Posted March 26, 2012 Author Share Posted March 26, 2012 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
drk Posted March 26, 2012 Share Posted March 26, 2012 We don't know, you posted this event, we have only solved the issues. Link to comment
Castillo Posted March 26, 2012 Share Posted March 26, 2012 -- 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
sckatchof Posted March 26, 2012 Author Share Posted March 26, 2012 thank you snake for help it just col 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