مثال فقط
كلنت
local screenW, screenH = guiGetScreenSize()
window = guiCreateWindow((screenW - 200) / 2, (screenH - 284) / 2, 200, 284, "", false)
guiWindowSetSizable(window, false)
gridlist = guiCreateGridList(9, 22, 183, 227, false, window)
guiGridListAddColumn(gridlist, "Name", 0.9)
button = guiCreateButton(9, 248, 182, 26, "سحب السياره", false, window)
for _, player in ipairs(getElementsByType("player")) do
local row = guiGridListAddRow (gridlist)
guiGridListSetItemText (gridlist, row,1, getPlayerName ( player ), false, false )
end
addEventHandler("onClientGUIClick",button,function()
if ( guiGridListGetSelectedItem(gridlist) ~= -1 ) then
local plrs = guiGridListGetItemText(gridlist, guiGridListGetSelectedItem(gridlist),1)
triggerServerEvent("ss",localPlayer,_,plrs)
else
outputChatBox('قم بالتحديد على اسم اللاعب لسحب سيارته',255,0,0,true)
end
end,false)
سيرفر
addEvent("ss",true)
addEventHandler("ss",root,function (Player,who)
local PlayerName = getPlayerFromName ( who )
local Vehicle = getPedOccupiedVehicle (PlayerName)
if PlayerName then if Vehicle then
destroyElement (Vehicle)
outputChatBox(getPlayerName (source).. ' تم سحب سيارتك من قبل' ,PlayerName,255,255,0,true)
else
outputChatBox('هذا اللاعب لايملك سياره',Player,255,0,0,true)
end
else
outputChatBox('هذا اللاعب ليس موجود',Player,255,0,0,true)
end
end)