Jump to content

* حل مشكلة في GridList


Recommended Posts

السلام عليكم ورحمة الله وبركاته
عندي مشكلة بمود اتمنى الرد بأسرع وقت فيه

سويت الجريد لست وخليته يجيب اسماء اللاعبين

لكن ما يجيب الا اسم شخص واحد ومعلومات شخص آخر

التجربة


 

KPahmedGridList = guiCreateGridList(10, 25, 580, 245, false )

C1 = guiGridListAddColumn(KPahmedGridList, "Players", 0.2)
C2 = guiGridListAddColumn(KPahmedGridList, "Money", 0.2)
C3 = guiGridListAddColumn(KPahmedGridList, "Ping", 0.2)
C4 = guiGridListAddColumn(KPahmedGridList, "FPS", 0.2)
C5 = guiGridListAddColumn(KPahmedGridList, "Wanted", 0.2)
C6 = guiGridListAddColumn(KPahmedGridList, "x", 0.2)
C7 = guiGridListAddColumn(KPahmedGridList, "y", 0.2)
C8 = guiGridListAddColumn(KPahmedGridList, "z", 0.2)
C9 = guiGridListAddColumn(KPahmedGridList, "Health", 0.2)
C10 = guiGridListAddColumn(KPahmedGridList, "zone name", 0.2)

for i = 1, 10 do
myRow = guiGridListAddRow (KPahmedGridList)
end

function DeveloperAhmedKillerProject ()

for id, player in ipairs(getElementsByType("player")) do

x,y,z = getElementPosition( player )
Area =  getZoneName( x,y,z )

guiGridListSetItemText ( KPahmedGridList, myRow, C1, getPlayerName ( player ), false, false )
guiGridListSetItemText ( KPahmedGridList, myRow, C2, getPlayerMoney ( player ), false, false )
guiGridListSetItemText ( KPahmedGridList, myRow, C3, getPlayerPing ( player ), false, false )
guiGridListSetItemText ( KPahmedGridList, myRow, C4, getFPSLimit ( player ), false, false )
guiGridListSetItemText ( KPahmedGridList, myRow, C5, getPlayerWantedLevel ( player ), false, false )
guiGridListSetItemText ( KPahmedGridList, myRow, C6, x, false, false )
guiGridListSetItemText ( KPahmedGridList, myRow, C7, y, false, false )
guiGridListSetItemText ( KPahmedGridList, myRow, C8, z, false, false )
guiGridListSetItemText ( KPahmedGridList, myRow, C9, getElementHealth ( player ), false, false )
guiGridListSetItemText ( KPahmedGridList, myRow, C10, Area, false, false )

playerName = guiGridListGetItemText ( KPahmedGridList, guiGridListGetSelectedItem ( KPahmedGridList ), 1 )

end

end
addEventHandler("onClientRender", root, DeveloperAhmedKillerProject)

 

Link to comment

ما ينفع كذا

لازم تسوي جدول 

table = { } 

وتضيف المعلومات داخل الجدول

table.insert ( table , { playerName , Ping , Money }  )

وترسل ترايقر بالجدول

triggerClientEvent ( root,"GetInfo",root,table)

وتسوي كذا بكلاينت


function add(table)
	guiGridListClear( grid )
	for k,v in ipairs( table ) do
		guiGridListSetItemText ( grid guiGridListAddRow( grid ), c.n, v[1], false, false )
		guiGridListSetItemText ( grid, guiGridListAddRow( grid ), c.o, v[2], false, false )
		guiGridListSetItemText ( grid, guiGridListAddRow( grid ), c.s, v[3], false, false )
	end	
end
addEvent("GetInfo",true)
addEventHandler("GetInfo",root,add)

بس !

ولا تنسى اللوب بسيرفر

for k, v in ipairs .... do -- لوب للاعبين

local ping = getPlayerPing(v)

local money = getPlayerMoney ( v )

الخخ

  • Like 2
Link to comment
1 hour ago, #_iMr.[E]coo said:

ما ينفع كذا

لازم تسوي جدول الخخ

انا نوب شوي في الجريد ليست

 

--Server


function toSend ()
local players = getElementsByType ( "player" )

for k, v in ipairs (players) do

local playerName = getPlayerPing ( v )
local Ping = getPlayerName ( v )
local Money = getPlayerMoney ( v ) 

table.insert ( table , { playerName , Ping , Money }  )
triggerClientEvent ( root,"GetInfo",root,table) 

end

end

setTimer ( toSend,50,0 )


-- Client


grid = guiCreateGridList(10, 25, 580, 245, false)
local row = guiGridListAddRow ( playerList )
function add(table)
	guiGridListClear( grid )
	for k,v in ipairs( table ) do
	
		guiGridListSetItemText ( grid, guiGridListAddRow( grid ), 0.2, v[1], false, false )
		guiGridListSetItemText ( grid, guiGridListAddRow( grid ), 0.2, v[2], false, false )
		guiGridListSetItemText ( grid, guiGridListAddRow( grid ), 0.2, v[3], false, false )
	
	end	
end
addEvent("GetInfo",true)
addEventHandler("GetInfo",root,add)

 

Link to comment

في كود فتح اللوحة حط ذا - 

triggerServerEvent ("ToSendINFO",localPlayer) 

وفي سيرفر حط ذا :)

addEvent("ToSendINFO",true)
addEventHandler("ToSendINFO",root,
function()
	local table = {}
    for i, v in ipairs(getElementsByType("player")) do
		local player = getPlayerName(v)
		local ping = getPlayerPing ( v )
		local money = getPlayerMoney( v )
		table.insert(table,{player,ping,money})
    end
	triggerClientEvent("AddINFO",root,table)	
end)

وفي كلاينت ذا ;)

function addINFO(table)
	guiGridListClear( grid )
	for k,v in ipairs( table ) do
		guiGridListSetItemText ( grid guiGridListAddRow( grid ), 1, v[1], false, false )
		guiGridListSetItemText ( grid, guiGridListAddRow( grid ), 2, v[2], false, false )
		guiGridListSetItemText ( grid, guiGridListAddRow( grid ), 3, v[3], false, false )
	end	
end
addEvent("AddINFO",true)
addEventHandler("AddINFO",root,addINFO)

:)

 

Link to comment
18 minutes ago, #_iMr.[E]coo said:

في كود فتح اللوحة حط ذا - 


triggerServerEvent ("ToSendINFO",localPlayer) 

وفي سيرفر حط ذا :)


addEvent("ToSendINFO",true)
addEventHandler("ToSendINFO",root,
function()
	local table = {}
    for i, v in ipairs(getElementsByType("player")) do
		local player = getPlayerName(v)
		local ping = getPlayerPing ( v )
		local money = getPlayerMoney( v )
		table.insert(table,{player,ping,money})
    end
	triggerClientEvent("AddINFO",root,table)	
end)

وفي كلاينت ذا ;)


function addINFO(table)
	guiGridListClear( grid )
	for k,v in ipairs( table ) do
		guiGridListSetItemText ( grid guiGridListAddRow( grid ), 1, v[1], false, false )
		guiGridListSetItemText ( grid, guiGridListAddRow( grid ), 2, v[2], false, false )
		guiGridListSetItemText ( grid, guiGridListAddRow( grid ), 3, v[3], false, false )
	end	
end
addEvent("AddINFO",true)
addEventHandler("AddINFO",root,addINFO)

:)

 

table.insert(table,{player,ping,money}) خطأ هنا

Link to comment
changeGridListItemToPlayersInfo = function ( GridList, Column, Column2, Column3,Column4,Column5,Column6,Column7,Column8,Column9,Column10 ) 
    if GridList and Column and Column2 and Column2 and Column3 and Column4 and Column5 and Column6 and Column7 and Column8 and Column9 and Column10 then -- Check Parematers 
        if getElementType ( GridList ) == "gui-gridlist" then -- Check The Type of ' GridList ' 
            if guiGridListClear ( GridList ) then -- Clear GridList 
                for i, v in next, getElementsByType ( "player" ) do -- Get Everything by Type ' player '  
                    local Row = guiGridListAddRow ( GridList ) -- Add Row 
					local x, y, z = getElementPosition( v )
					local Area = getZoneName( x,y,z )
                    guiGridListSetItemText ( GridList, Row, Column, getPlayerName ( v ), false, false ); -- Set New Values
					guiGridListSetItemText ( GridList, Row, Column2, getPlayerMoney ( v ), false, false ); -- Set New Values 
					guiGridListSetItemText ( GridList, Row, Column3, getPlayerPing ( v ), false, false ); -- Set New Values 
					guiGridListSetItemText ( GridList, Row, Column4, getFPSLimit ( v ), false, false ); -- Set New Values 
					guiGridListSetItemText ( GridList, Row, Column5, getPlayerWantedLevel ( v ), false, false ); -- Set New Values 
					guiGridListSetItemText ( GridList, Row, Column6, x , false, false ); -- Set New Values 
					guiGridListSetItemText ( GridList, Row, Column7, y , false, false ); -- Set New Values 
					guiGridListSetItemText ( GridList, Row, Column8, z , false, false ); -- Set New Values 
					guiGridListSetItemText ( GridList, Row, Column9, getElementHealth ( v ), false, false ); -- Set New Values 
					guiGridListSetItemText ( GridList, Row, Column10, Area, false, false ); -- Set New Values 
                end; -- end of ' for ' 
            end; -- end of ' clear gridlist ' 
        end; -- end of ' check gridlist type ' 
    end; -- end of ' check parematers 
end; -- end of ' function ' 
-- Author : #3NAD , الحب : )
-- Edited : Wifi  : )

KPahmedGridList = guiCreateGridList(10, 25, 580, 245, false )

C1 = guiGridListAddColumn(KPahmedGridList, "Players", 0.2)
C2 = guiGridListAddColumn(KPahmedGridList, "Money", 0.2)
C3 = guiGridListAddColumn(KPahmedGridList, "Ping", 0.2)
C4 = guiGridListAddColumn(KPahmedGridList, "FPS", 0.2)
C5 = guiGridListAddColumn(KPahmedGridList, "Wanted", 0.2)
C6 = guiGridListAddColumn(KPahmedGridList, "x", 0.2)
C7 = guiGridListAddColumn(KPahmedGridList, "y", 0.2)
C8 = guiGridListAddColumn(KPahmedGridList, "z", 0.2)
C9 = guiGridListAddColumn(KPahmedGridList, "Health", 0.2)
C10 = guiGridListAddColumn(KPahmedGridList, "zone name", 0.2)
changeGridListItemToPlayersInfo(KPahmedGridList,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10)

 

Edited by iMr.WiFi..!
  • Like 2
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...