Jump to content

مساعدة


Recommended Posts

  • Scripting Moderators

عشان تحفظ الباندات

استعمل الداتا بيس

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

تأكد من الداتا  بيس إذا هو مصكوك او لا
وأرسل النتيجة للكلينت واحفظها على متغير

وإذا جاء يفك اللوحة سوي تحقق من المتغير يلي حفظته

إذا كان مصكوك فك الوحة رقم 2 إذا لا فك رقم 1
 

Link to comment
1 hour ago, KonaaaN200 said:

ممكن الأكواد لا هنت

 

Server

-- Server

addEventHandler("onResourceStart",resourceRoot,
	function()
		executeSQLQuery("CREATE TABLE IF NOT EXISTS BAN_LIST (PlayerSerial TEXT,ResponsibleSerial TEXT)");
	end
)

function onPlayerBanned(responsible)
	local player = source;
	local playerSerial = getPlayerSerial(player);
	local responsibleSerial = getPlayerSerial(responsible);
	local SQL = executeSQLQuery("SELECT * FROM BAN_LIST WHERE PlayerSerial=?",playerSerial);
	if SQL[1] == nil then
		executeSQLQuery("INSERT INTO BAN_LIST (PlayerSerial,ResponsibleSerial) VALUES(?,?)",playerSerial,responsibleSerial);
		local SQL = executeSQLQuery("SELECT * FROM BAN_LIST WHERE PlayerSerial=?",playerSerial);
		if SQL[1] ~= nil and SQL[1].PlayerSerial == playerSerial then
			triggerClientEvent(player,"onClientPlayerBanned",player,responsible);
		end
	else
		outputChatBox("هذا اللاعب في قائمة الحظر بالفعل !",responsible);
	end
end

addEvent("onPlayerBanned",true);
addEventHandler("onPlayerBanned",root,onPlayerBanned);

addEvent("OnClientStart",true);
addEventHandler("OnClientStart",root,function()
	local playerSerial = getPlayerSerial(source);
	local SQL = executeSQLQuery("SELECT * FROM BAN_LIST WHERE PlayerSerial=?",playerSerial);
	if SQL[1] == nil then
		triggerClientEvent(source,"OnClientStart",source);
	else
		triggerClientEvent(source,"OnClientStart",source,true);
	end
end)

 

 

Client

BanPlayer(player): 

  1. player : اللاعب اللي تبي تحظره , طبعاً انت تحدد طريقة اختيار اللاعب انا ماحددت طريقة انا حطيت الفنكشن بس
-- client
local key1 = "F2"; -- زر اللوحة الاولى
local key2 = "F3"; -- زر اللوحة الثانية
local window1 = var1; -- الى متغير اللوحة الاولى var1 غير
local window2 = var2; -- الى متغير اللوحة الثانية var2 غير

function OpenFirstWindow()
	if not guiGetVisible(window1) then
		guiSetVisible(window1,true);
		showCursor(true);
	else
		guiSetVisible(window1,false);
		showCursor(false);
	end 
end

function OpenSecondWindow()
	if not guiGetVisible(window2) then
		guiSetVisible(window2,true);
		showCursor(true);
	else
		guiSetVisible(window2,false);
		showCursor(false);
	end 
end

addEventHandler("onClientResourceStart",resourceRoot,function()
	triggerServerEvent("OnClientStart",localPlayer);
end);
function BanPlayer(player)
	if player and isElement(player) and getElementType(player)=="player" then
		local responsible = localPlayer;
		triggerServerEvent("onPlayerBanned",player,responsible);
		return true;
	end
	return false;
end

function onClientPlayerBanned(responsible)
	outputChatBox("لقد تم حظرك من قبل "..getPlayerName(responsible):gsub("#%x%x%x%x%x%x",""),244,14,14);
	unbindKey("زر اللوحة المحظورة","down",OpenFirstWindow);
	bindKey("زر اللوحة الثانية","down",OpenSecondWindow);
	guiSetVisible(window1,false);
	showCursor(false);
end

addEvent("onClientPlayerBanned",true);
addEventHandler("onClientPlayerBanned",root,onClientPlayerBanned);

addEvent("OnClientStart",true);
addEventHandler("OnClientStart",root,function(isBanned)
	if not isBanned then
		bindKey(key1,"down",OpenFirstWindow);
	else
		bindKey(key2,"down",OpenSecondWindow);
	end
end)
Edited by VenomNX
Link to comment

ال var2; +var1;

شلون اسويهم

addEventHandler("onClientPreRender", root,
function()
	if guiGetVisible(BanWindow) then
		if getElementData(localPlayer, "SupportBan") and guiGetVisible(BanWindow) then
			guiSetText(BReason, "Ban Reason : "..getElementData(localPlayer, "SBanReason"))
			guiSetText(BTime, "Ban Time : "..getElementData(localPlayer, "SBanTime"))
			guiSetText(BTime2, "Time untill your ban end : "..getElementData(localPlayer, "SBanTimer"))
			guiSetText(BAdmin, "Responsible Admin : "..getElementData(localPlayer, "SBanBy"))
		end
	end
end)


addEventHandler("onClientGUIClick", resourceRoot,
function()

if source == Punishment_Punish and guiComboBoxGetSelected(Punishment_Box) ~= -1 then
		local playerName = guiGridListGetItemText(PlayersGridList, guiGridListGetSelectedItem(PlayersGridList), 1)
		local Reason = guiGetText(Punishment_ReasonEdit) or "No Reason"
		local Time = guiGetText(Punishment_TimeEdit) or 60
		local Type = guiComboBoxGetItemText(Punishment_Box, guiComboBoxGetSelected(Punishment_Box))
		local Punish = guiGridListGetItemText(Punishment_GridList, guiGridListGetSelectedItem(Punishment_GridList), 1)
		if Punish == "Ban Player" then
		BanPlayerS(playerName, Reason, Time, Type)
		elseif source == Punishment_Remove_Punish then
		local playerName = guiGridListGetItemText(PlayersGridList, guiGridListGetSelectedItem(PlayersGridList), 1)
		local Punish = guiGridListGetItemText(Punishment_GridList, guiGridListGetSelectedItem(Punishment_GridList), 1)
		if Punish == "Ban Player" then
			unBanPlayer(playerName)
		end
	end
end
end)	

--هذا الي طلع معي الصبح بس مازبظ !

 

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...