Jump to content

ابي مساعدة في مود العاجل


#Doctor

Recommended Posts

ابيك في مساعدة في مود العاجل ابي اضيفله خاصية (العاجل مغلق مئقتا )هذا هوا  المود

AdminMessage-Server.lua 


Groups = {  -- القروبات المسموح لها بالكتابة
"Console",
"AM",
} 

-------------------- لا داعي لتعديل الأكواد تحت هذا السطر -------------------

function check ( thePlayer, commandName, ... )
        local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
		local veve = { ... }
		local message = table.concat ( veve, " " )
        for i, v in ipairs ( Groups ) do
          if isObjectInACLGroup ( "user."..accName, aclGetGroup ( v ) ) then		
		setElementData ( resourceRoot, "MessageAdmin", message);
		setElementData(resourceRoot,"PlrAdmin",getPlayerName(thePlayer));
        SaveMessage (  )
		triggerClientEvent ( "Bingo", getRootElement(  ), getElementData ( resourceRoot, "MessageAdmin" ) )
		end
	end
end
addCommandHandler( "AM", check )

addEventHandler ( "onResourceStart", resourceRoot, function (  )
        executeSQLQuery("CREATE TABLE IF NOT EXISTS SaveMessagee (Message, Server)")
end
)

addEvent ( "SetMessage", true )
addEventHandler ( "SetMessage", root, function (  )
   getMessage (  )
end
)

SaveMessage = function (  )
local msg = executeSQLQuery ( "SELECT * FROM SaveMessagee WHERE Server = '" .. getServerName ( ) .."'" )
if ( #msg ~= 0  )   then
   return executeSQLQuery("UPDATE SaveMessagee SET Message=? WHERE Server=? ", tostring ( getElementData ( resourceRoot, "MessageAdmin"  ) ), getServerName ( ) )
else
   return executeSQLQuery("INSERT INTO SaveMessagee (Message,Server) VALUES(?,?)", tostring ( getElementData ( resourceRoot, "MessageAdmin" ) ), getServerName ( ) )
   end
end

getMessage = function (  )
local msg = executeSQLQuery ( "SELECT * FROM SaveMessagee" )
if ( #msg ~= 0  ) then
    setElementData ( resourceRoot, "MessageAdmin", msg[1]["Message"] )
    return setTimer ( triggerClientEvent, 1000, 1, "Bingo", getRootElement(  ), getElementData ( resourceRoot, "MessageAdmin" ) )
else
   return setTimer ( triggerClientEvent, 1000, 1, "Bingo", getRootElement(  ), " " )
  end
end 



AdminMessage-Client.lua

-- * Created By Bingo
local x,y = guiGetScreenSize();

addEvent ( "Bingo", true )
addEventHandler ( "Bingo", getRootElement(),function(message)
	txt = message;
end)

addEventHandler("onClientRender", getRootElement(  ),function(  )
	if ( txt ) then
		dxDrawText ( "#0044FFAdmin :", x*(13.0/800), y*(167.0/600), x*(55.0/800), y*(182.0/600), tocolor ( 255, 255, 0, 255 ), 1.0, "default-bold", "left", "top", false, false, false ,true)
		dxDrawText (txt, x*(60.0/800), y*(168.0/600), x*(799.0/800), y*(224.0/600), tocolor ( 255, 255, 255, 255 ), 1.0, "default-bold", "left", "top", false, false, false ,true)
	end
	if ( getElementData(resourceRoot,"PlrAdmin") ) then
		dxDrawText("#ffffff "..getElementData(resourceRoot,"PlrAdmin"),x*(13.0/800),y*(184.0/600),x*(799.0/800),y*(224.0/600),tocolor(255,255,255,255),0.85,"default-bold","left","top",false,false,false,true)
	end
end)
	
bindKey ( "i", "down", "chatbox", "AM" ) -- تغير الزر


addEventHandler ( "onClientResourceStart", resourceRoot, function (  )
triggerServerEvent ( "SetMessage", localPlayer )
end
)
Link to comment

ملف السيرفر 

 

local Groups = { "Console", "AM" }
local Serials = {
["سريالك1"] = true,
["سريالك2"] = true
}
function isPlayerAdmin(player)
for k,v in ipairs ( Groups ) do
if aclGetGroup(v) then
if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup(v)) then
return true
end
end
end
end
addEventHandler("onResourceStart", resourceRoot,
function()
for _,player in ipairs(getElementsByType("player")) do
if isPlayerAdmin(player) then
bindKey(player, "u", "down", "chatbox", "IM")
end
end
end
)
addCommandHandler("IM",
function(player,_,...)
local data = getElementData(getResourceRootElement(getThisResource()), "AdminMessage") or {false, "", "opened"}
if not isGuestAccount(getPlayerAccount(player)) then
if isPlayerAdmin(player) then
if data[2] ~= "closed" then
local message = table.concat({...}, " ")
setElementData(getResourceRootElement(getThisResource()), "AdminMessage", {true, message, "opened"})
else
outputChatBox("العاجل مغلق", player, 255, 0, 0, true)
end
end
end
end
)
addCommandHandler("قفل",
function(player)
if Serials[getPlayerSerial(player)] then
local data = getElementData(getResourceRootElement(getThisResource()), "AdminMessage") or {false, "", "opened"}
if data[3] ~= "closed" then
setElementData(getResourceRootElement(getThisResource()), "AdminMessage", {true, data[2], "closed"})
outputChatBox("تم اغلاق العاجل", player, 255, 0, 0, true)
else
setElementData(getResourceRootElement(getThisResource()), "AdminMessage", {true, data[2], "opened"})
outputChatBox("تم فتح العاجل", player, 0, 255, 0, true)
end
end
end
)


ملف الكلينت #@

 

function dxDrawBorderedText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, color2 )
    local wh = 1
    local msg_gsub = text:gsub ( '#%x%x%x%x%x%x', '' )
    dxDrawText ( msg_gsub, x - wh, y - wh, w - wh, h - wh, tocolor ( 0, 0, 0, 0 ), scale, font, alignX, alignY, clip, wordBreak, false ) -- black
    dxDrawText ( msg_gsub, x + wh, y - wh, w + wh, h - wh, tocolor ( 0, 0, 0, 0 ), scale, font, alignX, alignY, clip, wordBreak, false )
    dxDrawText ( msg_gsub, x - wh, y + wh, w - wh, h + wh, tocolor ( 0, 0, 0, 0 ), scale, font, alignX, alignY, clip, wordBreak, false )
    dxDrawText ( msg_gsub, x + wh, y + wh, w + wh, h + wh, tocolor ( 0, 0, 0, 0  ), scale, font, alignX, alignY, clip, wordBreak, false )
    dxDrawText ( msg_gsub, x - wh, y, w - wh, h, tocolor ( 0, 0, 0, 0 ), scale, font, alignX, alignY, clip, wordBreak, false )
    dxDrawText ( msg_gsub, x + wh, y, w + wh, h, tocolor ( 0, 0, 0, 0  ), scale, font, alignX, alignY, clip, wordBreak, false )
    dxDrawText ( msg_gsub, x, y - wh, w, h - wh, tocolor ( 0, 0, 0, 0  ), scale, font, alignX, alignY, clip, wordBreak, false )
    dxDrawText ( msg_gsub, x, y + wh, w, h + wh, tocolor ( 0, 0, 0, 0  ), scale, font, alignX, alignY, clip, wordBreak, false )
    dxDrawText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, color2 )
end

addEventHandler("onClientRender", root,
	function ()
		local data = getElementData(getResourceRootElement(getThisResource()), "AdminMessage") or {false, "", "N/A"}
		local text = data[2]
		if data[1] then
			dxDrawBorderedText("#1a75ffAdmin : #FFFFFF"..text, 33, 221, 205, 242, tocolor(255, 255, 255, 255), 1.0, "default-bold", "left", "top", true, false, true, true, true)
		end
	end
)

 

  • Thanks 1
Link to comment



Groups = {  -- القروبات المسموح لها بالكتابة
"Console",
"AM",
} 

-------------------- لا داعي لتعديل الأكواد تحت هذا السطر -------------------

function check ( thePlayer, commandName, ... )
if getElementData(resourceRoot,"oskar_") == 'false' then return outputChatBox('العاجل مغلق مؤقت',thePlayer,255,0,0,true) end
        local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
		local veve = { ... }
		local message = table.concat ( veve, " " )
        for i, v in ipairs ( Groups ) do
          if isObjectInACLGroup ( "user."..accName, aclGetGroup ( v ) ) then		
		setElementData ( resourceRoot, "MessageAdmin", message);
		setElementData(resourceRoot,"PlrAdmin",getPlayerName(thePlayer));
        SaveMessage (  )
		triggerClientEvent ( "Bingo", getRootElement(  ), getElementData ( resourceRoot, "MessageAdmin" ) )
		end
	end
end
addCommandHandler( "AM", check )



addCommandHandler("MM",function (thePlayer,command,source)
if source == 'false' then
        setElementData(resourceRoot,'oskar_','false')
      outputChatBox('تم قفل العاجل',thePlayer,255, 0, 0,true)
elseif source == 'true' then
       setElementData(resourceRoot,'oskar_','true')
      outputChatBox('تم فتح العاجل',thePlayer,0, 255 , 0,true)
end
end)

addEventHandler ( "onResourceStart", resourceRoot, function (  )
        executeSQLQuery("CREATE TABLE IF NOT EXISTS SaveMessagee (Message, Server)")
end
)

addEvent ( "SetMessage", true )
addEventHandler ( "SetMessage", root, function (  )
   getMessage (  )
end
)

SaveMessage = function (  )
local msg = executeSQLQuery ( "SELECT * FROM SaveMessagee WHERE Server = '" .. getServerName ( ) .."'" )
if ( #msg ~= 0  )   then
   return executeSQLQuery("UPDATE SaveMessagee SET Message=? WHERE Server=? ", tostring ( getElementData ( resourceRoot, "MessageAdmin"  ) ), getServerName ( ) )
else
   return executeSQLQuery("INSERT INTO SaveMessagee (Message,Server) VALUES(?,?)", tostring ( getElementData ( resourceRoot, "MessageAdmin" ) ), getServerName ( ) )
   end
end

getMessage = function (  )
local msg = executeSQLQuery ( "SELECT * FROM SaveMessagee" )
if ( #msg ~= 0  ) then
    setElementData ( resourceRoot, "MessageAdmin", msg[1]["Message"] )
    return setTimer ( triggerClientEvent, 1000, 1, "Bingo", getRootElement(  ), getElementData ( resourceRoot, "MessageAdmin" ) )
else
   return setTimer ( triggerClientEvent, 1000, 1, "Bingo", getRootElement(  ), " " )
  end
end 

اكتب ب اف 8

MM true >>  مفتوح

MM false >> مقفول

  • Thanks 1
Link to comment
addCommandHandler("قفل", function( plr )
 local acc = getPlayerAccount( plr )
 local accName = getAccountName ( acc )
 if isGuestAccount(acc) then return end
 if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Console" ) ) then 
if ( getElementData(plr, "ChatL") == true ) then
setElementData(plr, "ChatL", false)
outputChatBox("تم اغلاق العاجل",root,255,0,0,true) 
else
setElementData(plr, "ChatL", true)
outputChatBox("تم فتح العاجل",root,255,255,255,true)          
end 
else
end
end)

addCommandHandler("IM",function ( source,_,...)
if ( getElementData(source, "ChatL") == false ) then return outputChatBox("مغلق",source,255,0,0,true) end
		local message = table.concat ( veve, " " )
        for i, v in ipairs ( Groups ) do
          if isObjectInACLGroup ( "user."..accName, aclGetGroup ( v ) ) then	
setElementData(resourceRoot,"Msg_",msg)
setElementData(resourceRoot,"Have_",true)
setElementData(resourceRoot,"By_",getPlayerName(source))
else
end
end)

شباب تكفون حطو لى لى يقفل العاجل ويفتحو تكون على سريال وجروب المسوحة لها بالكتوب Msg+Console

Link to comment
5 hours ago, MrKAREEM said:

اوكك اسف لو مبردش عليك اليومين دول بس مشغول

رد لان فيه شئ ابي اقوله لك عن السيرفر الي شغالين عليه كلنا ولازم تعرفها

ذا الشي بأسرع وقت ما ينفع اقول في العام

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