Jump to content

تعديل بسيط جدا


Recommended Posts

السلام عليكم

الكود ذا

GUIEditor_Grid = {}

wnd = guiCreateWindow(249,102,312,455,"#اسماء_الاعبين_بالسرفر",false)
GUIEditor_Grid[1] = guiCreateGridList(9,24,294,422,false,wnd)
guiGridListSetSelectionMode(GUIEditor_Grid[1],2)
guiSetVisible(wnd,false)
guiWindowSetMovable(wnd,false)


function OpenWin()
if guiGetVisible ( wnd ) then
guiSetVisible ( wnd, false )
showCursor(false)
guiSetInputEnabled(false)
else
guiSetVisible ( wnd, true )
showCursor(true)
guiSetInputEnabled(true)
end
end
bindKey("F7", "down", OpenWin)


local col = guiGridListAddColumn(GUIEditor_Grid[1],"Player name",0.90)
local coll = guiGridListAddColumn(GUIEditor_Grid[1],"Player account",0.90)

for id,player in ipairs( getElementsByType ( "player" ) ) do
			local row = guiGridListAddRow ( GUIEditor_Grid[1] )
			guiGridListSetItemText ( GUIEditor_Grid[1], row, col, getPlayerName ( player ), false, false )
			guiGridListSetItemText ( GUIEditor_Grid[1], row, coll, getAccountName ( getPlayerAccount ( player ) ), false, false )
		end

المفروض انو يجيب في جريد ليست جميع حسابات واسامي

الاعبين الي بالسرفر

هو يجيب الاسم عادي

لاكن الحسابات م يجيبها

ارجو التعديل

Link to comment

جرب

-- Client
addEvent ( "GetPlayers", true )
addEventHandler ( "GetPlayers", root,
	function ( accounts, playerName )
		local row = guiGridListAddRow ( GUIEditor_Grid[1] )
		guiGridListSetItemText ( GUIEditor_Grid[1], row, col, playerName, false, false )
		guiGridListSetItemText ( GUIEditor_Grid[1], row, coll, accounts, false, false )
	end
)

-- Server
function getAccountsAndName ( )
	for i,v in ipairs( getElementsByType ( "player" ) ) do
		local playerName = getPlayerName ( v )
		local accounts = getAccountName ( getPlayerAccount ( v ) )
			triggerClientEvent ( root,"GetPlayers", root,playerName,accounts)
	end
end

getAccountsAndName ( )

 

Link to comment
16 hours ago, Deativated said:

جرب


-- Client
addEvent ( "GetPlayers", true )
addEventHandler ( "GetPlayers", root,
	function ( accounts, playerName )
		local row = guiGridListAddRow ( GUIEditor_Grid[1] )
		guiGridListSetItemText ( GUIEditor_Grid[1], row, col, playerName, false, false )
		guiGridListSetItemText ( GUIEditor_Grid[1], row, coll, accounts, false, false )
	end
)

-- Server
function getAccountsAndName ( )
	for i,v in ipairs( getElementsByType ( "player" ) ) do
		local playerName = getPlayerName ( v )
		local accounts = getAccountName ( getPlayerAccount ( v ) )
			triggerClientEvent ( root,"GetPlayers", root,playerName,accounts)
	end
end

getAccountsAndName ( )

 

 

إذا قمت بعمل الترايقر بهذا الشكل سيأثر علي السيرفر( اذا كان عدد لاعبينك 50 ومافوق ) بسبب تكرار الترايقر بعدد اللاعبين المتواجدين بالسيرفر

 

  • Like 1
Link to comment
-- Server #
function TAc()
for i, players in ipairs( getElementsByType("player") ) do
local account = getPlayerAccount(players)
if account and not isGuestAccount(account) then
account = getAccountName(account)
else
account = "N/A"
end
setElementData(player, "Account", account)
end
end
addEventHandler("onResourceStart", resourceRoot,TAc)
addEventHandler("onPlayerJoin", root,TAc)
addEventHandler("onPlayerChangeNick", root,TAc)

-- Client #
guiGridListSetItemText ( GUIEditor_Grid[1], row, columen, ""..getElementData(player,"Account").."", false, false )

غير ارجمنتات الجريد لست الى حقك حسب اللاعب اللي تبغاه والكولومن الخ..

Link to comment
2 hours ago, #_iMr.[E]coo said:

@#BrosS

طريقتك غلط , لازم تسوي لوب للجميع الحسابات بالسيرفر عشان تجيب الحسابات

شيعرفني انه يبي كل الحسابات

ظنتته يبي اللاعب اللي بالسيرفر فقط

Link to comment
---------سيرفر
addEvent('getAccounts',true)
addEventHandler('getAccounts',root,function()
  local el=getElementsByType('player')
    local thetable={}
    for k,v in ipairs(el)do
    local acc=getPlayerAccount(v)
      if not isGuestAccount(acc)then
        table.insert(thetable,{getAccountName(acc),getPlayerName(v)})
        else
                table.insert(thetable,{'Guest',getPlayerName(v)})
        end
    end
    triggerClientEvent(source,'setgrid',source,thetable)
  end)
--------client
triggerServerEvent('getAccounts',localPlayer)
addEvent('setgrid',true)
addEventHandler('setgrid',root,function(t)
    for k,v in ipairs(t)do
    guiGridListSetItemText(blallballbalbla----v[1])------acc name
          guiGridListSetItemText(blallballbalbla----v[2])------player name

    end
    end)

بالتوفيق

Edited by Master_MTA
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...