Jump to content

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


Recommended Posts

26 minutes ago, SaedAmer said:

ايه المشكلة هنا


outputChatBox("#FF0000 # #FFFFFF[ #CD0000"..tag .."#FFFFFF ]x #A5A5A5".. getPlayerName(source) .. ""..colour.." : ".. msg.."",root, 255, 255, 255, true)

p_578ptsgh1.jpg

يلي مكتوب بالدي بق هو انه كولر يلي معرفه جدول مو سترنقcolour وريني تعريف 

Link to comment
1 hour ago, Mhmd.z said:

يلي مكتوب بالدي بق هو انه كولر يلي معرفه جدول مو سترنق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)


executeSQLQuery("CREATE TABLE IF NOT EXISTS PlayersTag (player, serial, tag, colour)")
addEventHandler("onPlayerQuit", root,
  function ()
    local tag = getElementData(source, "tag")
    local colour = getElementData(source, "colour")
    local playerName = getPlayerName(source)
    local serial = getPlayerSerial(source)
    local sqlTag = executeSQLQuery("SELECT tag FROM PlayersTag WHERE serial=?", serial)
    if isGuestAccount(getPlayerAccount(source)) then return end
    if not tag or not colour then return end
    if sqlTag == 0 then
      executeSQLQuery("INSERT INTO PlayersTag(player, serial, tag, colour) VALUES(?,?,?,?)", playerName, serial, tag, colour)
    else
      executeSQLQuery("UPDATE PlayersTag SET player=?,serial=?,tag=?,colour=? WHERE serial=?", playerName, serial, tag, colour)
    end
 end
)

addEventHandler("onPlayerLogin", root,
  function ()
    local serial = getPlayerSerial(source)
    local sqlTag = executeSQLQuery("SELECT tag FROM PlayersTag WHERE serial=?", serial)
    local sqlColour = executeSQLQuery("SELECT colour FROM PlayersTag WHERE serial=?", serial)
    if sqlTag ~= 0 then
      setElementData(source, "tag", sqlTag)
      setElementData(source, "colour", sqlColour)
      outputChatBox("Your tag is: "..sqlTag, source)
    else
      outputChatBox("You havn't a tag", source)
    end
  end
)

 

Link to comment
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
	)

 

Edited by Abdul KariM
  • Thanks 2
Link to comment
31 minutes ago, Abdul KariM said:

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
	)

 

تمام تسلم اشتغل 

بس الحذف مش شغال 

في تعديل علي الكود ولا لازم اسوي كود حذف من قعدة البيانات ؟


-----
addEventHandler("onClientGUIClick",root,function()
if(source == GUIEditor.button[2]) then
if guiGetText (GUIEditor.edit[1]) ~= '' then
setElementData (localPlayer,'tag',guiGetText (GUIEditor.edit[1]))
setElementData (localPlayer,'colour',guiGetText (GUIEditor.edit[2]))
end
elseif(source == GUIEditor.button[1]) then
setElementData (localPlayer,'tag',false)
setElementData (localPlayer,'colour',false)
end
end)

--------

 

Link to comment
14 minutes ago, Abdul KariM said:

لو تبي تحذف التاج نهائي لازم من السكل

كده ؟

كلنت


-----
addEventHandler("onClientGUIClick",root,function()
if(source == GUIEditor.button[2]) then
if guiGetText (GUIEditor.edit[1]) ~= '' then
setElementData (localPlayer,'tag',guiGetText (GUIEditor.edit[1]))
setElementData (localPlayer,'colour',guiGetText (GUIEditor.edit[2]))
end
elseif(source == GUIEditor.button[1]) then
setElementData (localPlayer,'tag',false)
setElementData (localPlayer,'colour',false)
triggerServerEvent("DelTag",localPlayer)
end
end)

--------

سيرفر

addEvent("noLocal",true)
addEventHandler("noLocal", root,
function()
			 local tag = executeSQLQuery ( "DELETE tag FROM PlayersTag WHERE Serial =?", getPlayerSerial(source) )
			 local colour = executeSQLQuery ( "DELETE colour FROM PlayersTag WHERE Serial =?", getPlayerSerial(source) )
end )

 

Link to comment

client 

addEventHandler("onClientGUIClick",root,

	function (	)

	if( source == GUIEditor.button[2] ) then

	if guiGetText ( GUIEditor.edit[1] ) ~= '' then

	setElementData (localPlayer,'tag',guiGetText (GUIEditor.edit[1]))

	setElementData (localPlayer,'colour',guiGetText (GUIEditor.edit[2]))

	end

	elseif( source == GUIEditor.button[1] ) then

	triggerServerEvent("DelTag",localPlayer)

		end
	end
	)

server


	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 
	)	

 

  • Thanks 2
Link to comment
9 minutes ago, Abdul KariM said:

guiGridListGetSelectedItem
guiGridListGetItemText
getPlayerFromName
triggerServerEvent
setElementData

 

صح ؟

كلنت


----------
addEventHandler("onClientGUIClick",GUIEditor.button[1],function()
local playerName = guiGridListGetItemText (GUIEditor.gridlist[1], guiGridListGetSelectedItem (GUIEditor.gridlist[1] ), 1 )
if playerName and guiGetText(GUIEditor.edit[1]) then
triggerServerEvent("AddTag",localPlayer,playerName,guiGetText(GUIEditor.edit[1]))
end
end,false)

سيرفر


addEvent("AddTag",true)
addEventHandler("AddTag", getRootElement(),function(Player,tag)
local name = getPlayerFromName(Player)
if name then
setElementData (name,'tag',tag)
end
end)

 

Link to comment
8 minutes ago, Default said:

اذا حطيته اطلع وأدخل شوف يجيك ولا ؟

اخوي كود الحفط تمام اشتغل انا اتكلم علي ده

 

On ٢‏/٨‏/٢٠١٧ at 02:24, SaedAmer said:

صح ؟

كلنت


----------
addEventHandler("onClientGUIClick",GUIEditor.button[1],function()
local playerName = guiGridListGetItemText (GUIEditor.gridlist[1], guiGridListGetSelectedItem (GUIEditor.gridlist[1] ), 1 )
if playerName and guiGetText(GUIEditor.edit[1]) then
triggerServerEvent("AddTag",localPlayer,playerName,guiGetText(GUIEditor.edit[1]))
end
end,false)

سيرفر


addEvent("AddTag",true)
addEventHandler("AddTag", getRootElement(),function(Player,tag)
local name = getPlayerFromName(Player)
if name then
setElementData (name,'tag',tag)
end
end)

 

 

هذا لما اختار لاعب من الجريد لست و اكتب في التاج و الون

و اضغط البوتن التاج يروح للاعب الي انا محدده

----

جربت الكود ماشتغل ولا طلع شئ بالديب بق

Edited by SaedAmer
Link to comment
-- # Client

addEventHandler ( "onClientGUIClick" , root , function ( )
if ( source == GUIEditor.button[1] ) 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
end
end );

-- # Server

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
8 minutes ago, Default said:

 

جربت الكود محصلش حاجة نفس الكلام

+

التاج مش بيتمسح و طبعا اذا تفيط المود مقدر اتكلم بالشات

دي الاكواد كاملة بدون الوحة

كلنت

-------



        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])


----------


addEventHandler ( "onClientGUIClick" , root , function ( )
if ( source == GUIEditor.button[1] ) 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
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         
            outputChatBox('# [TagSystem]: تم تفعيل التاج  ',0,255,0,true )
        end
    end
)
 
 
 
 addEventHandler( 'onClientGUIClick', root,
    function()
        if (source ==  GUIEditor.button[1]) then         
            outputChatBox('# [TagSystem]: تم ارجاع التاج كما كان  ',255,0,0,true )
        end
    end
)

addEventHandler("onClientGUIClick",root,

	function (	)

	if( source == GUIEditor.button[2] ) then

	if guiGetText ( GUIEditor.edit[1] ) ~= '' then

	setElementData (localPlayer,'tag',guiGetText (GUIEditor.edit[1]))

	setElementData (localPlayer,'colour',guiGetText (GUIEditor.edit[2]))

	end

	elseif( source == GUIEditor.button[1] ) then

	triggerServerEvent("DelTag",localPlayer)

		end
	end
	)

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

 

سيرفر

 


addEvent("AddTag",true)
addEventHandler("AddTag", root , function ( plr , value )
if ( getPlayerFromName ( plr ) ) then 
setElementData ( getPlayerFromName ( plr ) , "tag" , value ) ;
savePlayerTag ( getPlayerFromName ( plr ) ) 
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 
	)	

 

Link to comment
addEvent("AddTag",true)
addEventHandler("AddTag", root , function ( plr , value )
if ( getPlayerFromName ( plr ) ) then 
setElementData ( getPlayerFromName ( plr ) , "tag" , value ) ;
savePlayerTag ( getPlayerFromName ( plr ) ) 
outputChatBox("Right!",source,100,100,100,true)
end
end)

شوف يجيك بالشات ولا

Link to comment
16 minutes ago, Default said:

addEvent("AddTag",true)addEventHandler("AddTag", root , function ( plr , value )if ( getPlayerFromName ( plr ) ) then setElementData ( getPlayerFromName ( plr ) , "tag" , value ) ;savePlayerTag ( getPlayerFromName ( plr ) ) outputChatBox("Right!",source,100,100,100,true)endend)

شوف يجيك بالشات ولا

ماجاتش حاجة بالشات

 

Link to comment

كلنت


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
)



----------
addEvent("AddTag",true)
addEventHandler("AddTag", root , function ( plr , value )
if ( getPlayerFromName ( plr ) ) then 
setElementData ( getPlayerFromName ( plr ) , "tag" , value ) ;
savePlayerTag ( getPlayerFromName ( plr ) ) 
outputChatBox("Right!",source,100,100,100,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         
            outputChatBox('# [TagSystem]: تم تفعيل التاج  ',0,255,0,true )
        end
    end
)
 
 
 
 addEventHandler( 'onClientGUIClick', root,
    function()
        if (source ==  GUIEditor.button[1]) then         
            outputChatBox('# [TagSystem]: تم ارجاع التاج كما كان  ',255,0,0,true )
        end
    end
)

addEventHandler("onClientGUIClick",root,

	function (	)

	if( source == GUIEditor.button[2] ) then

	if guiGetText ( GUIEditor.edit[1] ) ~= '' then

	setElementData (localPlayer,'tag',guiGetText (GUIEditor.edit[1]))

	setElementData (localPlayer,'colour',guiGetText (GUIEditor.edit[2]))

	end

	elseif( source == GUIEditor.button[1] ) then

	triggerServerEvent("DelTag",localPlayer)

		end
	end
	)

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

سيرفر

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
)


addEvent("AddTag",true)
addEventHandler("AddTag", root , function ( plr , value )
if ( getPlayerFromName ( plr ) ) then 
setElementData ( getPlayerFromName ( plr ) , "tag" , value ) ;
savePlayerTag ( getPlayerFromName ( plr ) ) 
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 
	)	

 

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