Jump to content

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


Recommended Posts

السلام عليكم الاول

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

و اكتب التاج و الون و اضغط البوطن يتفعل عند العب مب عندي انا

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

ايه الخطأ هنا ما يبي يحفظ

executeSQLQuery( "CREATE TABLE IF NOT EXISTS `DataPlayers` ( Player,tag ) " )

 

Edited by SaedAmer
Link to comment
26 minutes ago, SaedAmer said:

السلام عليكم الاول

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

و اكتب التاج و الون و اضغط البوطن يتفعل عند العب مب عندي انا

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

ايه الخطأ هنا ما يبي يحفظ


executeSQLQuery( "CREATE TABLE IF NOT EXISTS `DataPlayers` ( Player,tag ) " )

 

الكود ذا

انشاء قاعده مب حفظ

Link to comment
20 minutes ago, Default said:

executeSQLQuery -- INSERT خش على صفحة الويكي وتعرف 

مظبوط؟

 

addEventHandler("onPlayerChat",root,function (msg,Colour)
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, r, g, b, true)
return cancelEvent()
end)
 
 executeSQLQuery( ' INSERT INTO `DataPlayers` (Player,Serial,tag,colour) VALUES(?,?,?,?) ', getPlayerName(source), getPlayerSerial(source), tag, colour)

 

Link to comment
3 hours ago, SaedAmer said:

مظبوط؟

 


addEventHandler("onPlayerChat",root,function (msg,Colour)
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, r, g, b, true)
return cancelEvent()
end)
 
 executeSQLQuery( ' INSERT INTO `DataPlayers` (Player,Serial,tag,colour) VALUES(?,?,?,?) ', getPlayerName(source), getPlayerSerial(source), tag, colour)

 

عطنا لما تضيف واحد للقاعدة انت هنا بس عطيتنا جزء

Link to comment
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)
executeSQLQuery( ' INSERT INTO `DataPlayers` (Player,Serial,tag,colour) VALUES(?,?,?,?) ', getPlayerName(source), getPlayerSerial(source), tag, colour)
return cancelEvent()
end)

 

 

Edited by Mhmd.z
Link to comment
46 minutes ago, Mhmd.z said:

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)
executeSQLQuery( ' INSERT INTO `DataPlayers` (Player,Serial,tag,colour) VALUES(?,?,?,?) ', getPlayerName(source), getPlayerSerial(source), tag, colour)
return cancelEvent()
end)


 

 

نفس الكلام مفيش حاجة بتتحفظ 

Link to comment

وعليكم السلام ورحمة الله وبركاته

اولا تقوم بإنشاء القاعدة عند تشغيل السكربت

ثانيا تقوم بالحفظ في القاعدة عند الضغط على الزر

ثالثا تقوم بإستخراج القيم عند الكتابة في الشات وعن طريق --

executeSQLQuery -- SELECT

 

Link to comment
48 minutes ago, ` Allawi said:

وعليكم السلام ورحمة الله وبركاته

اولا تقوم بإنشاء القاعدة عند تشغيل السكربت

ثانيا تقوم بالحفظ في القاعدة عند الضغط على الزر

ثالثا تقوم بإستخراج القيم عند الكتابة في الشات وعن طريق --


executeSQLQuery -- SELECT

 

ناقص ايه ؟

executeSQLQuery( "CREATE TABLE IF NOT EXISTS `DataPlayers` ( Player,Serial,tag,colour ) " )

executeSQLQuery( ' INSERT INTO `DataPlayers` (Player,Serial,tag,colour) VALUES(?,?,?,?) ', getPlayerName(source), getPlayerSerial(source), tag, colour)

executeSQLQuery("DELETE FROM `DataPlayers` WHERE name=?", Player,Serial,tag,colour)

 

Link to comment
19 minutes ago, Mhmd.z said:

executeSQLQuery("SELECT tag FROM DataPlayers WHERE Serial=?", getPlayerSerial(source) )

ذا مثال لاستخراج تاج الاعب من سيرياله

و بعد ايه ناقص ؟

كيف بيكون تريتيب اكواد الحفظ ؟

Link to comment
Just now, SaedAmer said:

و بعد ايه ناقص ؟

كيف بيكون تريتيب اكواد الحفظ ؟

كذه تكون حفظته للقاعدة INSERT انت اول ما تسوي

SELECT الحين مشان تجيب الشي يلي حفظته لازم تستخدم

مثلا:

addCommandHandler("get",
  function (player)
    local tag = executeSQLQuery("SELECT tag FROM DataPlayers WHERE Serial=?", getPlayerSerial(player) )
    if tag ~= 0 then
      outputChatBox("Your tag is: "..tag, player)
    else
      outputChatBox("You havn't a tag", player)
    end
  end
)

 

Link to comment

 تمام كده؟

ذا الانشاء و الحفظ و الاسترجاء و الحذف

كلنت


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

--------

سيرفر


executeSQLQuery( "CREATE TABLE IF NOT EXISTS `DataPlayers` ( 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)
executeSQLQuery( ' INSERT INTO `DataPlayers` (Player,Serial,tag,colour) VALUES(?,?,?,?) ', getPlayerName(source), getPlayerSerial(source), tag, colour)
return cancelEvent()
end)


addCommandHandler("get",
  function (player)
    local tag = executeSQLQuery("SELECT tag FROM `DataPlayers` WHERE Serial=?", getPlayerSerial(player) )
    if tag ~= 0 then
      outputChatBox("Your tag is: "..tag, player)
    else
      outputChatBox("You havn't a tag", player)
    end
  end
)

 

Edited by SaedAmer
Link to comment
3 minutes ago, SaedAmer 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)
end
end)

--------

سيرفر


executeSQLQuery( "CREATE TABLE IF NOT EXISTS `DataPlayers` ( 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)
executeSQLQuery( ' INSERT INTO `DataPlayers` (Player,Serial,tag,colour) VALUES(?,?,?,?) ', getPlayerName(source), getPlayerSerial(source), tag, colour)
return cancelEvent()
end)


addCommandHandler("get",
  function (player)
    local tag = executeSQLQuery("SELECT tag FROM `DataPlayers` WHERE Serial=?", getPlayerSerial(player) )
    if tag ~= 0 then
      outputChatBox("Your tag is: "..tag, player)
    else
      outputChatBox("You havn't a tag", player)
    end
  end
)

 

اتوقع انه مافي اخطاء جربه ...

Link to comment
addEventHandler("onPlayerLogin", root,
  function ()
    local tag = executeSQLQuery("SELECT tag FROM `DataPlayers` WHERE Serial=?", getPlayerSerial(source) )
    local colour = executeSQLQuery("SELECT colour FROM `DataPlayers` WHERE Serial=?", getPlayerSerial(source) )
    if tag ~= 0 then
      outputChatBox("Your tag is: "..tag, player)
      setElementData(source, "tag", tag)
      setElementData(source, "colour", colour)
    end
  end
)

ضيف ذا الحدث تحت اكوادك

Link to comment
11 minutes ago, Mhmd.z said:

addEventHandler("onPlayerLogin", root,
  function ()
    local tag = executeSQLQuery("SELECT tag FROM `DataPlayers` WHERE Serial=?", getPlayerSerial(source) )
    local colour = executeSQLQuery("SELECT colour FROM `DataPlayers` WHERE Serial=?", getPlayerSerial(source) )
    if tag ~= 0 then
      outputChatBox("Your tag is: "..tag, player)
      setElementData(source, "tag", tag)
      setElementData(source, "colour", colour)
    end
  end
)

ضيف ذا الحدث تحت اكوادك

p_57860yfb1.png

Edited by SaedAmer
Link to comment
28 minutes ago, ` Allawi said:

شوف ردي في هذا الموضوع ممكن تستفيد منه

 

بالنسبة لك الكود هيك يعني تقصد ؟

addEventHandler ( "onResourceStart", resourceRoot, 
	function ( )
		executeSQLQuery ( "CREATE TABLE IF NOT EXISTS `DataPlayers` ( Player,Serial,tag,colour )" )
	end
)

addEventHandler("onPlayerLogin", root, 
	function ( _, PlayerSeria )
		    local tag = executeSQLQuery("SELECT tag FROM `DataPlayers` WHERE Serial=?", getPlayerSerial(source) )
                                         local colour = executeSQLQuery("SELECT colour FROM `DataPlayers` WHERE Serial=?", getPlayerSerial(source) )
		if ( tag ~= 0 ) then
			      setElementData(source, "tag", tag)
                                                             setElementData(source, "colour", colour)
		end
	end
)

addEventHandler ( "onPlayerQuit", root, 
	function ( )
		local PlayerSerial = getPlayerSerial(source)
		if ( PlayerSeria ) and not isGuestAccount ( PlayerSeria ) then
			local PlayerSeria = getPlayerSerial(source)
			 local tag = executeSQLQuery ( "SELECT tag FROM `DataPlayers` WHERE Serial =?", getPlayerSerial(source) )
			 local colour = executeSQLQuery ( "SELECT tag FROM `DataPlayers` WHERE Serial =?", getPlayerSerial(source) )
			if ( tag == 0 ) then
				executeSQLQuery( ' INSERT INTO `DataPlayers` (Player,Serial,tag,colour) VALUES(?,?,?,?) ', getPlayerName(source), getPlayerSerial(source), tag, colour)
			else
				executeSQLQuery ( "UPDATE `DataPlayers` SET tag=? WHERE Serial=?", getPlayerName(source), getPlayerSerial(source), tag, colour )
			end
		end
	end
)

 

9 minutes ago, #,+( _xiRoc[K]; > said:

غير اسم الجدول

سويت مثل ما قلت 

رجعنا من الاول ولا بيحفظ ولا بيسترجع ولا شئ

executeSQLQuery( "CREATE TABLE IF NOT EXISTS TagPlayer ( Player,Serial,tag,colour ) " )

 

Edited by SaedAmer
Link to comment
1 minute ago, #,+( _xiRoc[K]; > said:

انا مافهمت وش تبي تسوي

دلوقتي مسوي مود اعطاء تاج

ابي احدد علي الاعب و اعطيه التاج ...ء

نحن شغالين الان في الحفظ 

اني اسوي قاعدة بينات و جداول 

و احفظ  و لما يخرج من السيرفر و يرجع 

التاج يكون موجود

لين احذفه من المود

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

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