Jump to content

×[ طلب كود - تعديل كود ]×


Recommended Posts

Client : 


GUIEditor = {
    edit = {},
    button = {},
    window = {},
    label = {},
    gridlist = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
local screenW, screenH = guiGetScreenSize()
        GUIEditor.window[1] = guiCreateWindow((screenW - 431) / 2, (screenH - 402) / 2, 431, 402, "Tag Panel", false)
        guiWindowSetSizable(GUIEditor.window[1], false)
        guiSetProperty(GUIEditor.window[1], "CaptionColour", "FFFFFEFE")

        GUIEditor.gridlist[1] = guiCreateGridList(9, 22, 230, 370, false, GUIEditor.window[1])
        guiGridListAddColumn(GUIEditor.gridlist[1], "Players", 0.9)
        GUIEditor.edit[1] = guiCreateEdit(250, 32, 171, 31, "التاج", false, GUIEditor.window[1])
        GUIEditor.edit[2] = guiCreateEdit(250, 70, 171, 32, "#FFFFFF", false, GUIEditor.window[1])
        GUIEditor.button[1] = guiCreateButton(246, 325, 75, 29, "حذف", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFFFEFE")
        GUIEditor.button[2] = guiCreateButton(346, 325, 75, 29, "تفعيل", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFFFEFE")
        GUIEditor.label[1] = guiCreateLabel(316, 373, 99, 19, "Created By #S3eeD", false, GUIEditor.window[1])
        guiLabelSetColor(GUIEditor.label[1], 225, 0, 0) 
        guiSetVisible( GUIEditor.window[1], false) 
    end
)


addEvent ( 'open', true )
addEventHandler ( 'open', root,
    function ( )
        if guiGetVisible (GUIEditor.window[1]) then
            guiSetVisible (GUIEditor.window[1], false )
            showCursor ( false )
            guiSetInputEnabled ( false )
        else
            guiSetVisible (GUIEditor.window[1], true )
            showCursor ( true )
            guiSetInputEnabled ( true )
        end
    end
)



----------





function update ()
guiGridListClear(GUIEditor.gridlist[1])
for i,v in ipairs (getElementsByType("player")) do
local rp = guiGridListAddRow (GUIEditor.gridlist[1])
guiGridListSetItemText (GUIEditor.gridlist[1],rp,1,getPlayerName(v),false,false)
end
end
addEventHandler ("onClientResourceStart",resourceRoot,update)
addEventHandler ("onClientPlayerJoin",root,update)
addEventHandler ("onClientPlayerChangeNick",root,update)
addEventHandler ("onClientPlayerQuit",root,update)

--------------


addEventHandler("onClientGUIClick",root,function ()
if( source == GUIEditor.button[2] ) then
local sel = guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ) ;
if ( sel ~= 0 and guiGetText ( GUIEditor.edit[1] ) ~= "" ) then 
triggerServerEvent ( "AddTag" , localPlayer , guiGridListGetItemText ( GUIEditor.gridlist[1] , sel , 1 ) , guiGetText ( GUIEditor.edit[1] ) );
end
elseif( source == GUIEditor.button[1] ) then
triggerServerEvent("DelTag",localPlayer)
outputChatBox('# [TagSystem]: تم ارجاع التاج كما كان  ',255,0,0,true )
end
end 
)


outputChatBox('# [TagSystem]: Created By #S3eeD',0,255,0,true )

Server : 

addCommandHandler ( 'open',
    function ( thePlayer )
        accName = getAccountName ( getPlayerAccount ( thePlayer ) )
        if isObjectInACLGroup ('user.'..accName, aclGetGroup ( "Console" ) ) then
            triggerClientEvent( thePlayer, 'open', thePlayer )
        else
            outputChatBox ( "* You Don't Have Permissions !!", thePlayer, 255, 0, 0, true )
        end
    end
)

executeSQLQuery("CREATE TABLE IF NOT EXISTS PlayersTag (player, serial, tag, colour)")
addEventHandler("onPlayerChat",root,function (msg)
local tag = getElementData(source,"tag") or 'player'
local colour = getElementData(source,"colour") or '#FFFFFF' 
outputChatBox("#FF0000 # #FFFFFF[ #CD0000"..tag .."#FFFFFF ]x #A5A5A5".. getPlayerName(source) .. ""..colour.." : ".. msg.."",root, 255, 255, 255, true)
return cancelEvent()
end)
------------
	function getPlayerTag ( player )
	
	local playerSerial = player and getPlayerSerial ( player )
	
	local playerResult = executeSQLQuery("SELECT * FROM PlayersTag WHERE serial = ? ", playerSerial )
	
	if ( #playerResult ~= 0 and type ( playerResult ) == "table" ) then
		
			return playerResult [ 1 ] [ "tag" ] , playerResult [ 1 ] [ "colour" ]
		end
		return false
	end
	function savePlayerTag ( player )
	
	local playerSerial = player and getPlayerSerial ( player )
	
	local playerTag = getElementData ( player , "tag" ) or false
	
	local playerColor = getElementData ( player , "colour" ) or false
	
	local playerName = getPlayerName ( player )
	
	if ( not playerTag or not playerColor ) then 
	
		return false
	end
	
	if ( getPlayerTag ( player ) ~= false ) then
	
	executeSQLQuery("UPDATE PlayersTag SET player=?,tag=?,colour=? WHERE serial=?", playerName, playerTag, playerColor,playerSerial)
	
	else
	
	executeSQLQuery("INSERT INTO PlayersTag(player, serial, tag, colour) VALUES(?,?,?,?)", playerName, playerSerial, playerTag, playerColor)
			return true
		end
		return false
	end
addEventHandler("onPlayerQuit", root,
	function (	)
 
	savePlayerTag ( source )
 
	end
	)
addEventHandler("onPlayerLogin", root,
	function (	)
	
	local playerTag , playerColor = getPlayerTag ( source )
  
	if ( playerTag and playerColor ) then
  
	setElementData ( source , "tag" , playerTag )
	
	setElementData ( source , "colour" , playerColor )
  
		end
	end
	)
	-------------
	
	
	function DeletePlayerTag ( player )
 
	if ( getPlayerTag ( player ) == false ) then
	
		return false
	end
	
	local playerSerial = getPlayerSerial ( player )
 
	executeSQLQuery("DELETE FROM PlayersTag WHERE serial=?", playerSerial )
 
	setElementData ( player , "tag" , false )
	
	setElementData ( player , "colour" , false )
		return true
	end
	
addEvent("DelTag",true)
addEventHandler("DelTag", root,
	function (	)
	DeletePlayerTag ( source )
	
	end 
	)	
	
	addEvent("AddTag",true)
addEventHandler("AddTag", root , function ( plr , value )
if ( getPlayerFromName ( plr ) ) then 
setElementData ( getPlayerFromName ( plr ) , "tag" , value ) ;
savePlayerTag ( getPlayerFromName ( plr ) ) 
end
end );

 

  • Like 1
Link to comment
3 hours ago, Default said:

Client : 

Server : 

 

الحذف ما يحذف شئ

------------

اخر شئ

في هدول

local tag = getElementData(source,"tag") or 'player'
local colour = getElementData(source,"colour") or '#FFFFFF' 

انا مسوي مود تاج م حاتط كود ما يكررو مع بعض

    if getElementData(source,"tag")  then return cancelEvent() end
    if type == 1 or type == 2 then return end

الكود شغال و كل شئ بس لما احط تاق فقط

ف انا اقدر امسح 

 or 'player'
 or '#FFFFFF' 

و اخليهم كدا

local tag = getElementData(source,"tag") 
local colour = getElementData(source,"colour") 

بدون ما يجيني اي خطأ بالدي بق ؟

جربت و جالي خطأ فالتاج و الكولور

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