Jump to content

executeSQLQuery طلب مبرمج يسويلي


Recommended Posts

سلام عليكم

ابي مبرمج يسويلي بس

لو رسترت العاجل - العاجل القديم الي كنت مسويه يضل زي ما هو ما يروح

لان لسا اتدرب علي 

executeSQLQuery

وما اعرف لها زين - وشكرا

كلنت

local sX, sY = guiGetScreenSize ()

addEventHandler("onClientRender", root, function ()
    if ( getElementData ( resourceRoot, "Have_" ) == true ) then
        local Lines = getChatboxLayout ()["chat_lines"]
	    if ( Lines <= 10 ) then
	        Lines = Lines + 1
	    elseif ( Lines >= 20 ) then
	        Lines = Lines - 1
	    else
	        Lines = Lines
	    end
		if ( getElementData ( resourceRoot, "Msg_" ) == "ايقاف العاجل" ) then
		    setElementData ( resourceRoot, "Have_", false )
		else

        dxDrawText("Admin : ✱╚▶ ║ " .. getElementData ( resourceRoot, "Msg_" ).. " ║◄╝✱", 14 - 1, 194 - 1, 953 - 1, 212 - 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Admin : ✱╚▶ ║ " .. getElementData ( resourceRoot, "Msg_" ).. " ║◄╝✱", 14 + 1, 194 - 1, 953 + 1, 212 - 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Admin : ✱╚▶ ║ " .. getElementData ( resourceRoot, "Msg_" ).. " ║◄╝✱", 14 - 1, 194 + 1, 953 - 1, 212 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Admin : ✱╚▶ ║ " .. getElementData ( resourceRoot, "Msg_" ).. " ║◄╝✱", 14 + 1, 194 + 1, 953 + 1, 212 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Admin : ✱╚▶ ║ " .. getElementData ( resourceRoot, "Msg_" ).. " ║◄╝✱", 14, 194, 953, 212, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("".. getElementData ( resourceRoot, "By_" ) .."", 16 - 1, 213 - 1, 211 - 1, 232 - 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("".. getElementData ( resourceRoot, "By_" ) .."", 16 + 1, 213 - 1, 211 + 1, 232 - 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("".. getElementData ( resourceRoot, "By_" ) .."", 16 - 1, 213 + 1, 211 - 1, 232 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("".. getElementData ( resourceRoot, "By_" ) .."", 16 + 1, 213 + 1, 211 + 1, 232 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("".. getElementData ( resourceRoot, "By_" ) .."", 16, 213, 211, 232, tocolor(145, 143, 143, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
		end
	end
end)
bindKey("u", "down", "chatbox","AdminMsg")
" .. getElementData ( resourceRoot, "Msg_" ).. "

سيرفر

local Groups = { "Console", "AdminMsg" }

function isPlayerAdmin(player)
    for k,v in ipairs ( Groups ) do
        if ( isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup(v)) ) then
		    return true
		end
	end
end

addCommandHandler("AdminMsg", function ( player, cmd, ... )
    if not ( isGuestAccount ( getPlayerAccount ( player ) ) ) then
	    if ( isPlayerAdmin ( player ) ) then
		    local msg = {...}
		    local message = table.concat(msg, " ")
			setElementData ( resourceRoot, "Have_", true )
			setElementData ( resourceRoot, "Msg_", message )
			if ( getElementData ( player, "Name" ) and getElementData ( player, "Name" ) ~= false ) then
				setElementData ( resourceRoot, "By_", getElementData ( player, "Name" ))
			else
				setElementData ( resourceRoot, "By_", getPlayerName ( player ))
			end
		else
		    outputChatBox("* You Are Not Admin !", player, 255, 0, 0, true)
		end
	else
	    outputChatBox("* Please Login !", player, 255, 0, 0, true)
	end
end)

 

@+Source|>

  • Haha 1
Link to comment
1 minute ago, #_iMr,[E]coo said:

محاولتك طيب ؟ 

ع اساس تدرب ؟ فرجينا الي اتدربت عليه .

لسا مب عارف اي شي عن هذا الكود / القاعدة

3 minutes ago, #_iMr,[E]coo said:

محاولتك طيب ؟ 

ع اساس تدرب ؟ فرجينا الي اتدربت عليه .

طيب شوف بحاول - المحاولة شي حلو!

Link to comment
9 minutes ago, #_iMr,[E]coo said:

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

حاولت لكن كل الكود يعتبر مافي نقطة صح

حاول تقولي كيف اصلحه 

executeSQLQuery("CREATE TABLE IF NOT EXISTS saveAm (3agel TEXT, name TEXT)")

addCommandHandler("AdminMsg", function ( player, cmd, ... )
    if not ( isGuestAccount ( getPlayerAccount ( player ) ) ) then
	    if ( isPlayerAdmin ( player ) ) then
		    local msg = {...}
		    local message = table.concat(msg, " ")
			setElementData ( resourceRoot, "Have_", true )
			setElementData ( resourceRoot, "Msg_", message )
			executeSQLQuery("INSERT INTO saveAm(3agel,name) VALUES(?,?,?)", playerName )
			if ( getElementData ( player, "Name" ) and getElementData ( player, "Name" ) ~= false ) then
				setElementData ( resourceRoot, "By_", getElementData ( player, "Name" ))
			else
				setElementData ( resourceRoot, "By_", getPlayerName ( player ))
			end
		else
		    outputChatBox("* You Are Not Admin !", player, 255, 0, 0, true)
		end
	else
	    outputChatBox("* Please Login !", player, 255, 0, 0, true)
	end
end)

addEventHandler("onResourceStart", root, function ()
executeSQLQuery("SELECT 3agel FROM saveAm WHERE name=?", playerName )
end
)

 

Link to comment

قاعد اجرب حركة, ومدري اذا بتظبط ولا لا لكن جرب الكود ورد علي

executeSQLQuery("CREATE TABLE IF NOT EXISTS 3ajel ( myText TEXT, playerName TEXT )")

addCommandHandler("AdminMsg", function ( player, cmd, ... )
    if not ( isGuestAccount ( getPlayerAccount ( player ) ) ) then
	    if ( isPlayerAdmin ( player ) ) then
		    local msg = {...}
		    local message = table.concat(msg, " ")
			setElementData ( resourceRoot, "Have_", true )
			setElementData ( resourceRoot, "Msg_", message )
			if ( getElementData ( player, "Name" ) and getElementData ( player, "Name" ) ~= false ) then
				setElementData ( resourceRoot, "By_", getElementData ( player, "Name" ))
			else
				setElementData ( resourceRoot, "By_", getPlayerName ( player ))
			end
		else
		    outputChatBox("* You Are Not Admin !", player, 255, 0, 0, true)
		end
	else
	    outputChatBox("* Please Login !", player, 255, 0, 0, true)
	end
end)


function myEvents ()	
	if ( eventName == "onResourceStop" ) then
		if ( getElementData ( resourceRoot, "Msg_" ) ~= "" and getElementData ( resourceRoot, "By_" ) ~= "" ) then
			local result = executeSQLQuery ( 'SELECT * FROM 3ajel' )
			if ( #result == 0 ) then
				executeSQLQuery("INSERT INTO 3ajel ( myText, playerName ) VALUES( ?, ? )", getElementData ( resourceRoot, "Msg_" ) , getElementData ( resourceRoot, "By_" ) )
			else
				executeSQLQuery("UPDATE 3ajel SET myText=?, playerName=?", getElementData ( resourceRoot, "Msg_" ), getElementData ( resourceRoot, "By_" ) )
			end
		end
	elseif ( eventName == "onResourceStart" ) then
		local result = executeSQLQuery ( 'SELECT * FROM 3ajel' )
		if ( #result ~= 0 ) then
			setElementData ( resourceRoot, "Have_", true )
			setElementData ( resourceRoot, "Msg_", result[1].myText )
			setElementData ( resourceRoot, "By_", result[1].playerName )
		end
	end
end
addEventHandler("onResourceStop", root, myEvents)	
addEventHandler("onResourceStart", root, myEvents)

 

Link to comment
1 hour ago, N3xT said:

قاعد اجرب حركة, ومدري اذا بتظبط ولا لا لكن جرب الكود ورد علي


executeSQLQuery("CREATE TABLE IF NOT EXISTS 3ajel ( myText TEXT, playerName TEXT )")addCommandHandler("AdminMsg", function ( player, cmd, ... )    if not ( isGuestAccount ( getPlayerAccount ( player ) ) ) then	    if ( isPlayerAdmin ( player ) ) then		    local msg = {...}		    local message = table.concat(msg, " ")			setElementData ( resourceRoot, "Have_", true )			setElementData ( resourceRoot, "Msg_", message )			if ( getElementData ( player, "Name" ) and getElementData ( player, "Name" ) ~= false ) then				setElementData ( resourceRoot, "By_", getElementData ( player, "Name" ))			else				setElementData ( resourceRoot, "By_", getPlayerName ( player ))			end		else		    outputChatBox("* You Are Not Admin !", player, 255, 0, 0, true)		end	else	    outputChatBox("* Please Login !", player, 255, 0, 0, true)	endend)function myEvents ()		if ( eventName == "onResourceStop" ) then		if ( getElementData ( resourceRoot, "Msg_" ) ~= "" and getElementData ( resourceRoot, "By_" ) ~= "" ) then			local result = executeSQLQuery ( 'SELECT * FROM 3ajel' )			if ( #result == 0 ) then				executeSQLQuery("INSERT INTO 3ajel ( myText, playerName ) VALUES( ?, ? )", getElementData ( resourceRoot, "Msg_" ) , getElementData ( resourceRoot, "By_" ) )			else				executeSQLQuery("UPDATE 3ajel SET myText=?, playerName=?", getElementData ( resourceRoot, "Msg_" ), getElementData ( resourceRoot, "By_" ) )			end		end	elseif ( eventName == "onResourceStart" ) then		local result = executeSQLQuery ( 'SELECT * FROM 3ajel' )		if ( #result ~= 0 ) then			setElementData ( resourceRoot, "Have_", true )			setElementData ( resourceRoot, "Msg_", result[1].myText )			setElementData ( resourceRoot, "By_", result[1].playerName )		end	endendaddEventHandler("onResourceStop", root, myEvents)	addEventHandler("onResourceStart", root, myEvents)

 

Database query failed : unrecognized token : "3ajel"

غيرت اسم القاعدة 

واصلا صار المود مب شغال نهائي ومافي ديبق يطلع اصلا

@N3xT

1 hour ago, N3xT said:

قاعد اجرب حركة, ومدري اذا بتظبط ولا لا لكن جرب الكود ورد علي


executeSQLQuery("CREATE TABLE IF NOT EXISTS 3ajel ( myText TEXT, playerName TEXT )")addCommandHandler("AdminMsg", function ( player, cmd, ... )    if not ( isGuestAccount ( getPlayerAccount ( player ) ) ) then	    if ( isPlayerAdmin ( player ) ) then		    local msg = {...}		    local message = table.concat(msg, " ")			setElementData ( resourceRoot, "Have_", true )			setElementData ( resourceRoot, "Msg_", message )			if ( getElementData ( player, "Name" ) and getElementData ( player, "Name" ) ~= false ) then				setElementData ( resourceRoot, "By_", getElementData ( player, "Name" ))			else				setElementData ( resourceRoot, "By_", getPlayerName ( player ))			end		else		    outputChatBox("* You Are Not Admin !", player, 255, 0, 0, true)		end	else	    outputChatBox("* Please Login !", player, 255, 0, 0, true)	endend)function myEvents ()		if ( eventName == "onResourceStop" ) then		if ( getElementData ( resourceRoot, "Msg_" ) ~= "" and getElementData ( resourceRoot, "By_" ) ~= "" ) then			local result = executeSQLQuery ( 'SELECT * FROM 3ajel' )			if ( #result == 0 ) then				executeSQLQuery("INSERT INTO 3ajel ( myText, playerName ) VALUES( ?, ? )", getElementData ( resourceRoot, "Msg_" ) , getElementData ( resourceRoot, "By_" ) )			else				executeSQLQuery("UPDATE 3ajel SET myText=?, playerName=?", getElementData ( resourceRoot, "Msg_" ), getElementData ( resourceRoot, "By_" ) )			end		end	elseif ( eventName == "onResourceStart" ) then		local result = executeSQLQuery ( 'SELECT * FROM 3ajel' )		if ( #result ~= 0 ) then			setElementData ( resourceRoot, "Have_", true )			setElementData ( resourceRoot, "Msg_", result[1].myText )			setElementData ( resourceRoot, "By_", result[1].playerName )		end	endendaddEventHandler("onResourceStop", root, myEvents)	addEventHandler("onResourceStart", root, myEvents)

 

طيب شوف اسحب علي القاعدة الحين

كيف اسوي لو الشخص اسمه #ffffff

ما يحط اسمه بالعاجل؟

Link to comment

كدا ؟

@N3xT

addCommandHandler("AdminMsg", function ( player, cmd, ... )
    if not ( isGuestAccount ( getPlayerAccount ( player ) ) ) then
	    if ( isPlayerAdmin ( player ) ) then
		    local msg = {...}
		    local message = table.concat(msg, " ")
			setElementData ( resourceRoot, "Have_22", true )
			setElementData ( resourceRoot, "Msg_22", message )
			if ( getPlayerName(player) == "#ffffff" ) then
				setElementData ( resourceRoot, "By_22", getElementData ( player, "Name" ))
			else
				setElementData ( resourceRoot, "By_22", getPlayerName ( player ))
			end
		else
		    outputChatBox("* You Are Not Admin !", player, 255, 0, 0, true)
		end
	else
	    outputChatBox("* Please Login !", player, 255, 0, 0, true)
	end
end)

 

يب تمام ظبطت ان يجي الاسم مخفي لو اسمي

#ffffff

طيب كيف اخليه يجي مخفي لو اسمي فيه اي كود لون غير الابيض

مثلا

#ff0000

#ff00ff

اي كود لون وش التحقق حقه ؟

 

Link to comment

 

1 hour ago, Mr.Mostafa said:

كدا ؟

@N3xT


addCommandHandler("AdminMsg", function ( player, cmd, ... )
    if not ( isGuestAccount ( getPlayerAccount ( player ) ) ) then
	    if ( isPlayerAdmin ( player ) ) then
		    local msg = {...}
		    local message = table.concat(msg, " ")
			setElementData ( resourceRoot, "Have_22", true )
			setElementData ( resourceRoot, "Msg_22", message )
			if ( getPlayerName(player) == "#ffffff" ) then
				setElementData ( resourceRoot, "By_22", getElementData ( player, "Name" ))
			else
				setElementData ( resourceRoot, "By_22", getPlayerName ( player ))
			end
		else
		    outputChatBox("* You Are Not Admin !", player, 255, 0, 0, true)
		end
	else
	    outputChatBox("* Please Login !", player, 255, 0, 0, true)
	end
end)

 

يب تمام ظبطت ان يجي الاسم مخفي لو اسمي

#ffffff

طيب كيف اخليه يجي مخفي لو اسمي فيه اي كود لون غير الابيض

مثلا

#ff0000

#ff00ff

اي كود لون وش التحقق حقه ؟

 

string.gusb

  • Like 2
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...