addEventHandler("onClientGUIClick",GUIEditor_Button[2],
function ()
local row,col = guiGridListGetSelectedItem(GUIEditor_Grid[1])
if guiGridListGetSelectedItem( GUIEditor_Grid[1]) == -1 then return end
triggerServerEvent("RemoveRow",localPlayer,carName,row)
end
)
من بداية سطر 14
لو تلاحظ :
triggerServerEvent("RemoveRow",localPlayer,carName,row)
carName = غير معــــرفــــــه ..
هذا سكربت سويتة قبل سنة تقريباً تقدر تستفيد منة نفس طريقتك بس ركز يبي لة فهم زين وش العمود اللي تبي تحذفة وين اللي مختارة ادرسة زين ذذ :
----------------------
-- This Script
-- Scripted By
-- Mr.Pres[T]ege
-- Mail :
[email protected]
-- Main :
[email protected]
-- Skype : Mr.PresTege
-- [url=http://www.gta-arabs.com]www.gta-arabs.com[/url]
----------------------
local Key = "F10"
Panel = {
gridlist = {},
button = {},
label = {},
edit = {},
Window = {},
}
local rIP
local rPort
local rName
time = 15 --- time count - default : 10 seconds
function centerWindow(center_window,i,v)
local screenW,screenH=guiGetScreenSize()
local windowW,windowH=guiGetSize(center_window,false)
local x,y = (screenW-windowW)/i,(screenH-windowH)/v
guiSetPosition(center_window,x,y,false)
end
Panel.Window[1] = guiCreateWindow(37, 109, 420, 358, "==[ التحكم في التحويل بين الرومات ]==", false)
centerWindow(Panel.Window[1],2,2)
guiSetVisible(Panel.Window[1],false)
guiWindowSetSizable(Panel.Window[1], false)
guiSetAlpha(Panel.Window[1], 1.00)
guiSetProperty(Panel.Window[1], "CaptionColour", "FFEFFF00")
Panel.gridlist[1] = guiCreateGridList(9, 21, 402, 278, false, Panel.Window[1])
guiGridListAddColumn(Panel.gridlist[1], "اسم الروم #", 0.2)
guiGridListAddColumn(Panel.gridlist[1], "آي بي الروم #", 0.2)
guiGridListAddColumn(Panel.gridlist[1], "البورت للروم #", 0.2)
guiGridListAddColumn(Panel.gridlist[1], "نوع اللعب #", 0.2)
Panel.button[1] = guiCreateButton(11, 311, 114, 29, "التحويل للروم", false, Panel.Window[1])
guiSetFont(Panel.button[1], "default-bold-small")
guiSetProperty(Panel.button[1], "NormalTextColour", "FF00B9FF")
Panel.button[2] = guiCreateButton(154, 311, 114, 29, "اضافة روم", false, Panel.Window[1])
guiSetFont(Panel.button[2], "default-bold-small")
guiSetProperty(Panel.button[2], "NormalTextColour", "FF65FF00")
Panel.button[3] = guiCreateButton(308, 311, 102, 29, "حذف الروم", false, Panel.Window[1])
guiSetFont(Panel.button[3], "default-bold-small")
guiSetProperty(Panel.button[3], "NormalTextColour", "FFFF0000")
Panel.Window[2] = guiCreateWindow(523, 122, 354, 390, "==[ اضافة روم جديد # ]==", false)
guiSetVisible(Panel.Window[2],false)
centerWindow(Panel.Window[2],2,2)
guiWindowSetSizable(Panel.Window[2], false)
guiSetAlpha(Panel.Window[2], 1.00)
guiSetProperty(Panel.Window[2], "CaptionColour", "FF00FFA7")
Panel.label[2] = guiCreateLabel(11, 34, 342, 28, "اسم الروم المراد اضافتة للستة #", false, Panel.Window[2])
guiSetFont(Panel.label[2], "default-bold-small")
guiLabelSetColor(Panel.label[2], 255, 0, 0)
ServerName = guiCreateEdit(9, 69, 338, 32, "", false, Panel.Window[2])
Panel.label[3] = guiCreateLabel(10, 112, 341, 28, "اي بي الروم المراد اضافتة للستة #", false, Panel.Window[2])
guiSetFont(Panel.label[3], "default-bold-small")
guiLabelSetColor(Panel.label[3], 251, 254, 0)
ServerIP = guiCreateEdit(10, 145, 333, 32, "", false, Panel.Window[2])
Panel.label[4] = guiCreateLabel(9, 186, 315, 28, "بورت الروم المراد اضافتة للستة #", false, Panel.Window[2])
guiSetFont(Panel.label[4], "default-bold-small")
guiLabelSetColor(Panel.label[4], 0, 209, 254)
ServerPort = guiCreateEdit(10, 224, 331, 32, "", false, Panel.Window[2])
Panel.label[5] = guiCreateLabel(13, 263, 305, 28, "نوع اللعب المراد اضافتة للستة #", false, Panel.Window[2])
guiSetFont(Panel.label[5], "default-bold-small")
guiLabelSetColor(Panel.label[5], 35, 254, 0)
ServerType = guiCreateEdit(10, 291, 331, 32, "", false, Panel.Window[2])
Panel.button[4] = guiCreateButton(27, 338, 290, 37, "اضضضافةة الرومم #", false, Panel.Window[2])
guiSetFont(Panel.button[4], "default-bold-small")
guiSetProperty(Panel.button[4], "NormalTextColour", "FF00A7FE")
addEventHandler("onClientGUIClick",root,
function ( )
local row,col = guiGridListGetSelectedItem(Panel.gridlist[1])
local Name = guiGridListGetItemText(Panel.gridlist[1], row, 1)
local IP = guiGridListGetItemText(Panel.gridlist[1], row, 2)
local Port = guiGridListGetItemText(Panel.gridlist[1], row, 3)
if ( source == Panel.button[1] ) then
if ( guiGridListGetSelectedItem(Panel.gridlist[1]) == -1 ) then return outputChatBox("* الرجاء اختيار روم للتحويل الية",255,0,0,true) end
triggerServerEvent("RedirectPlayer",localPlayer,IP,Port,Name)
guiSetVisible(Panel.Window[1],false)
showCursor(false)
elseif ( source == Panel.button[2] ) then
guiSetVisible(Panel.Window[1],false)
guiSetVisible(Panel.Window[2],true)
showCursor(true)
elseif ( source == Panel.button[3] ) then
if ( guiGridListGetSelectedItem(Panel.gridlist[1]) == -1 ) then return outputChatBox("* الرجاء اختيار روم لـ حذفة",255,0,0,true) end
triggerServerEvent("RemoveServer",localPlayer,Name,IP,Port,row)
elseif ( source == Panel.button[4] ) then
local name,ip,port,type = guiGetText(ServerName),guiGetText(ServerIP),guiGetText(ServerPort),guiGetText(ServerType)
if ( name ~= "" and ip ~= "" and port ~= "" and type ~= "" ) then
if not tonumber(port) then return outputChatBox("* خطأ في الاي بي و البورت!!!",255,0,0,true) end
triggerServerEvent("Save:To:Data:Base",localPlayer, name, ip, port, type)
outputChatBox("* تم اضافة الروم بنجاح",0,255,0,true)
guiSetVisible(Panel.Window[2],false)
guiSetVisible(Panel.Window[1],true)
else
outputChatBox("* يجب ملئ جميع الفراغات !!",255,0,0,true)
end
end
end
)
addEvent ( "AddTextToGridList", true )
addEventHandler ( "AddTextToGridList", root,
function ( ServerName, ServerIP, ServerPort, ServerType )
local row = guiGridListAddRow ( Panel.gridlist[1] )
guiGridListSetItemText ( Panel.gridlist[1], row, 1, tostring ( ServerName ), false, false )
guiGridListSetItemText ( Panel.gridlist[1], row, 2, tostring ( ServerIP ), false, false )
guiGridListSetItemText ( Panel.gridlist[1], row, 3, tostring ( ServerPort ), false, false )
guiGridListSetItemText ( Panel.gridlist[1], row, 4, tostring ( ServerType ), false, false )
guiGridListSetItemColor ( Panel.gridlist[1], row, 1, 255, 255, 0 )
guiGridListSetItemColor ( Panel.gridlist[1], row, 2, 255, 0, 0 )
guiGridListSetItemColor ( Panel.gridlist[1], row, 3, 0, 255, 0 )
guiGridListSetItemColor ( Panel.gridlist[1], row, 4, 0, 0, 255 )
end
)
addEvent ( "Add", true )
addEventHandler ( "Add", root,
function ( onClientSqlList )
guiGridListClear ( Panel.gridlist[1] )
for _, v in ipairs ( onClientSqlList ) do
row = guiGridListAddRow ( Panel.gridlist[1] )
guiGridListSetItemText ( Panel.gridlist[1], row, 1, tostring ( v.ServerName ), false, false )
guiGridListSetItemText ( Panel.gridlist[1], row, 2, tostring ( v.ServerIP ), false, false )
guiGridListSetItemText ( Panel.gridlist[1], row, 3, tostring ( v.ServerPort ), false, false )
guiGridListSetItemText ( Panel.gridlist[1], row, 4, tostring ( v.ServerType ), false, false )
guiGridListSetItemColor ( Panel.gridlist[1], row, 1, 255, 255, 0 )
guiGridListSetItemColor ( Panel.gridlist[1], row, 2, 255, 0, 0 )
guiGridListSetItemColor ( Panel.gridlist[1], row, 3, 0, 255, 0 )
guiGridListSetItemColor ( Panel.gridlist[1], row, 4, 0, 0, 255 )
end
end
)
addEvent ( "Delete:Grid:Text:" , true)
addEventHandler ( "Delete:Grid:Text:" ,root,
function ( id )
guiGridListRemoveRow ( Panel.gridlist[1], tonumber( id ) )
end
)
addEventHandler ( "onClientResourceStart", resourceRoot,
function ( )
triggerServerEvent ( "RefreshList", localPlayer )
end
)
bindKey (Key, "down",
function()
if getElementData( localPlayer, 'Show_GUI') ~= nil then
guiSetVisible(Panel.Window[1], not guiGetVisible(Panel.Window[1]))
showCursor(guiGetVisible(Panel.Window[1]))
end
end
)
addEvent( 'LogOutSetVisible', true )
addEventHandler( 'LogOutSetVisible', root,
function()
if guiGetVisible(Panel.Window[1]) then
guiSetVisible( Panel.Window[1], false )
showCursor( false )
end
end
)
local function dxSetAlpha ( dx, a )
local r,g,b = dx:color()
dx:color(r,g,b,a)
end
local redict
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()),
function()
outputChatBox("* سكربت التحكم في الرومات ["..tostring(Key).."] ",0,0,255)
redict = dxText:create( "سيتم نقلك الى الروم المطلوب بعد ", 0.5, 0.5, true, "arial", 4 )
redict:type("stroke",1.2)
redict:color ( 255,255,0, 0 )
redict:visible(false)
end
)
local countdownFahad
local function countdown(time)
for i=time,0,-1 do
redict:text(" سيتم نقلك الى الروم "..rName.." | خلال "..i.." ثانية ")
setTimer ( countdownFahad, 1000, 1 )
coroutine.yield()
if i == 0 then setTimer ( stop, 500, 1 ) end
end
end
function stop()
setTimer (
function()
redict:visible(false)
if tostring( rIP ) and tonumber ( rPort ) then
triggerServerEvent("RedictPlayer",localPlayer,rIP,rPort)---Redict Player
end
end,
600, 1
)
Animation.createAndPlay(
redict,
{{ from = 255, to = 0, time = 400, fn = dxSetAlpha }}
)
end
function xShowTime(ip,port,Name)
rName = tostring ( Name )
rIP = tostring( ip )
rPort = tonumber( port )
Animation.createAndPlay(
redict,
{{ from = 0, to = 255, time = 600, fn = dxSetAlpha }}
)
redict:visible(true)
countdownFahad = coroutine.wrap(countdown)
countdownFahad(time)
end
addEvent("xShowTime",true)
addEventHandler("xShowTime",root,xShowTime)
----------------------
-- This Script
-- Scripted By
-- Mr.Pres[T]ege
-- Mail :
[email protected]
-- Main :
[email protected]
-- Skype : Mr.PresTege
-- [url=http://www.gta-arabs.com]www.gta-arabs.com[/url]
----------------------
local allowedGroup = "Console"
---------------------
-- SQL DataBase
--------------------
addEventHandler ( "onResourceStart", resourceRoot,
function ( )
executeSQLQuery ( "CREATE TABLE IF NOT EXISTS SQL_Data (ServerName,ServerIP,ServerPort,ServerType)" )
outputDebugString("SQL Data Base Server Owner System Started!",0,0,255,0,0)
for i, player in ipairs( getElementsByType( 'player' ) ) do
if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( allowedGroup ) ) then
setElementData( player, 'Show_GUI', true)
else
setElementData( player, 'Show_GUI', nil)
end
end
end
)
function setSQL_Data ( ServerName, ServerIP, ServerPort, ServerType )
return executeSQLQuery ( "INSERT INTO `SQL_Data` ( `ServerName`, `ServerIP`, `ServerPort`, `ServerType` ) VALUES ( ?, ?, ?, ? )", tostring(ServerName), tostring(ServerIP), tostring(ServerPort), tostring(ServerType) )
end
function SelectFromSql ( )
local data = executeSQLQuery ( "SELECT * FROM SQL_Data" )
if ( type ( data ) == "table" and #data == 0) or not data then
return { }
else
return data
end
end
function UpDateListInSql ( element )
if ( not isElement ( element ) ) then
return
end
local Upsql = SelectFromSql ( )
triggerClientEvent ( element, "Add", element, Upsql )
end
addEvent ( "RefreshList", true )
addEventHandler ( "RefreshList", root,
function ( )
UpDateListInSql ( source )
end
)
addEvent ( "Save:To:Data:Base", true )
addEventHandler ( "Save:To:Data:Base", root,
function ( ServerName, ServerIP, ServerPort, ServerType )
setSQL_Data ( ServerName, ServerIP, ServerPort, ServerType )
triggerClientEvent ( root, "AddTextToGridList", root, ServerName, ServerIP, ServerPort, ServerType )
end
)
addEvent("RemoveServer", true)
addEventHandler("RemoveServer", root,
function(Name,IP,Port,row)
if executeSQLQuery("DELETE FROM `SQL_Data` WHERE `ServerName` = '" .. tostring(Name) .. "' AND ServerIP = '" .. tostring(IP) .. "' AND ServerPort = '" .. tostring(Port) .. "'") then
triggerClientEvent("Delete:Grid:Text:",root,tonumber(row))
end
end
)
addEventHandler( 'onPlayerJoin', root, function()
setElementData( source, 'Show_GUI', nil)
end
)
addEventHandler( 'onPlayerLogin', root, function( _, acc )
if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( allowedGroup ) ) then
setElementData( source, 'Show_GUI', true)
else
setElementData( source, 'Show_GUI', nil)
end
end
)
addEventHandler( 'onPlayerLogout', root, function( _, acc )
triggerClientEvent( source, 'LogOutSetVisible', root)
setElementData( source, 'Show_GUI', nil)
end
)
--------------------
-- Main Function
--------------------
addEvent("RedirectPlayer",true)
addEventHandler("RedirectPlayer",root,
function ( IP,Port,Name )
for SQL,v in ipairs(getElementsByType("player")) do
triggerClientEvent( v, 'xShowTime', v, tostring(IP),tonumber(Port),tostring(Name))
end
end
)
addEvent("RedictPlayer",true)
addEventHandler("RedictPlayer",root,
function ( IP,Port )
redirectPlayer (source,tostring(IP),tonumber(Port))
end
)
بالتوفــيـــق ..