Jump to content

طلب كود حفظ بيانات القريد لست


Abu-Solo

Recommended Posts

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

كيف الحال عسـاكم طــيبين
ما اطول عليكم, انا ابغي كود حفظ الكلام اللي انا كتبتة في القريد لست.

لما اللاعب يدخل ويخش يكون منحفظ, ولما اسوي ريستارت للمود يكون منحفظ بعد

هذا الكود اللي انا مسوية, تقدر تجربة عشان تعرف وش اقصد. هذا مود زي مود التحديثات او شئ زي كذا

الطلب: ابغي كود حفظ الكلام اللي فـ القريد لست عن طريق 

executeSQLQuery

او اي طريقة اسهل

 


----------Client

wnd = guiCreateWindow(0.33, 0.27, 0.34, 0.46, "News", true)
guiWindowSetSizable(wnd, false)
guiSetVisible(wnd,false)
gridNews = guiCreateGridList(0.03, 0.07, 0.94, 0.69, true, wnd)
guiGridListAddColumn(gridNews, "News", 0.9)
Edarh = guiCreateButton(0.02, 0.80, 0.09, 0.10, "ادارة", true, wnd)


EdarahWindow = guiCreateWindow(0.32, 0.29, 0.37, 0.16, "ادارة", true)
guiWindowSetSizable(EdarahWindow, false)
guiSetProperty(EdarahWindow, "CaptionColour", "FFFE0000")
guiSetVisible(EdarahWindow,false)
SendEdit = guiCreateEdit(0.03, 0.21, 0.95, 0.21, "", true, EdarahWindow)
SendBTN = guiCreateButton(0.24, 0.52, 0.54, 0.15, "أرسال التحديث", true, EdarahWindow)
guiSetProperty(SendBTN, "NormalTextColour", "FFFDB300")

guiSetVisible(Close_BTN,false)
Close_BTN = guiCreateButton(0.66, 0.41, 0.02, 0.03, "X", true,EdarahWindow)



open = function()
    guiSetVisible( wnd, not guiGetVisible( wnd ) ) 
    showCursor( guiGetVisible( wnd ) )
end
bindKey('x','down',open)


serials = {
	["D30DD1F9735A43BBD31BB15F655D5EA2"] = true ,
}

addEventHandler("onClientGUIClick",root,
function()
if ( serials[ getPlayerSerial(localPlayer) ] ) then 
if source == Edarh then
guiSetVisible(EdarahWindow,true)
guiSetVisible(wnd,false)
guiSetInputEnabled(true)
showCursor(true)
elseif source == Close_BTN then
guiSetVisible(EdarahWindow,false)
guiSetVisible(wnd,true)
guiSetInputEnabled(false)
showCursor(true)
end
end
end
)


addEventHandler("onClientGUIClick", root, 
function ()
if source == SendBTN then
local Text = guiGetText(SendEdit)
if Text == "" or Text == " " then return end
triggerServerEvent("SendMessage", localPlayer, Text)
end
end
)
--------Server

addEvent("SendMessage", true)
addEventHandler("SendMessage", root,
function (Text)
triggerClientEvent(root, "RequestMessage", source, Text)
end)

 

Link to comment
local database = dbConnect ( "sqlite", "MSG_DB.db" )
dbExec ( database, "CREATE TABLE IF NOT EXISTS `MSG` (`TXT`)")

saveTheMessage = function ( text )
	if text then
		local db = dbPoll ( dbQuery ( database, "SELECT * FROM `MSG`" ), -1 )
		if #db > 0 then
			dbExec ( database, "UPDATE `MSG` SET `TXT`=?", tostring(text) )
		else
			dbExec ( database, "INSERT INTO `MSG` VALUES(?)", tostring(text) )
		end		
	end
end

getTheMessage = function ( )
	local message = ""
	local db = dbPoll ( dbQuery ( database, "SELECT * FROM `MSG`" ), -1 )
	if #db > 0 then
		message = tostring(db[1].TXT)
	end
	return message
end

 

طريقة الإستخدام؟

saveTheMessage ( text )

saveTheMessage ( "WELCOME" )

--

message = getTheMessage ( )

 

  • Like 2
Link to comment
  On 07/12/2016 at 16:14, 3NAD said:

local database = dbConnect ( "sqlite", "MSG_DB.db" )
dbExec ( database, "CREATE TABLE IF NOT EXISTS `MSG` (`TXT`)")

saveTheMessage = function ( text )
	if text then
		local db = dbPoll ( dbQuery ( database, "SELECT * FROM `MSG`" ), -1 )
		if #db > 0 then
			dbExec ( database, "UPDATE `MSG` SET `TXT`=?", tostring(text) )
		else
			dbExec ( database, "INSERT INTO `MSG` VALUES(?)", tostring(text) )
		end		
	end
end

getTheMessage = function ( )
	local message = ""
	local db = dbPoll ( dbQuery ( database, "SELECT * FROM `MSG`" ), -1 )
	if #db > 0 then
		message = tostring(db[1].TXT)
	end
	return message
end

 

طريقة الإستخدام؟


saveTheMessage ( text )

saveTheMessage ( "WELCOME" )

--

message = getTheMessage ( )

 

Expand  

هذا كله سيرفر, صح؟

Link to comment

مادري كيف فكرتك ,

 

بس انا فكرتي انه

 

Row = guiGridListAddRow ( GridTest )

aText = guiGridListGetItemText ( GridTest , Row , 1 )
triggerServerEvent ( 'Event' , localPlayer , aText )

 

و يروح يستقبل التريقر و يحفظه

Link to comment
  On 08/12/2016 at 14:03, #Soking said:

مادري كيف فكرتك ,

 

بس انا فكرتي انه

 

Row = guiGridListAddRow ( GridTest )

aText = guiGridListGetItemText ( GridTest , Row , 1 )
triggerServerEvent ( 'Event' , localPlayer , aText )

 

و يروح يستقبل التريقر و يحفظه

Expand  

اها, فهمتك .. بس اذا تقدر ترسلي الكود كامل فـ السيرفر

Link to comment
  On 08/12/2016 at 14:22, #Soking said:

addEvent('Event', true )
addEventHandler('Event' , getRootElement ( ) ,
function ( aText )
    saveTheMessage ( aText )
end )

 

Expand  

اوك مشكور, بس لما اللاعب يخرج او لما اسوي اعادة تشـغيل لـ المود ينحذف الكلام اللي كتبتة فـ القريد لست؟ ليش؟

Link to comment
  On 08/12/2016 at 14:27, #Soking said:

حط كل الاكواد اشوف

Expand  

Client


wnd = guiCreateWindow(0.33, 0.27, 0.34, 0.46, "News", true)
guiWindowSetSizable(wnd, false)
guiSetVisible(wnd,false)
gridNews = guiCreateGridList(0.03, 0.07, 0.94, 0.69, true, wnd)
guiGridListAddColumn(gridNews, "News", 0.9)
Edarh = guiCreateButton(0.02, 0.80, 0.09, 0.10, "ادارة", true, wnd)


EdarahWindow = guiCreateWindow(0.32, 0.29, 0.37, 0.16, "ادارة", true)
guiWindowSetSizable(EdarahWindow, false)
guiSetProperty(EdarahWindow, "CaptionColour", "FFFE0000")
guiSetVisible(EdarahWindow,false)
SendEdit = guiCreateEdit(0.03, 0.21, 0.95, 0.21, "", true, EdarahWindow)
SendBTN = guiCreateButton(0.24, 0.52, 0.54, 0.15, "أرسال التحديث", true, EdarahWindow)
guiSetProperty(SendBTN, "NormalTextColour", "FFFDB300")

guiSetVisible(Close_BTN,false)
Close_BTN = guiCreateButton(0.66, 0.41, 0.02, 0.03, "X", true,EdarahWindow)



open = function()
    guiSetVisible( wnd, not guiGetVisible( wnd ) ) 
    showCursor( guiGetVisible( wnd ) )
end
bindKey('x','down',open)


serials = {
	["D30DD1F9735A43BBD31BB15F655D5EA2"] = true ,
	["sssssssssssssssssssssssssssss"] = true ,
	["sssssssssssssssssssssssssssss"] = true
}

addEventHandler("onClientGUIClick",root,
function()
if ( serials[ getPlayerSerial(localPlayer) ] ) then 
if source == Edarh then
guiSetVisible(EdarahWindow,true)
guiSetVisible(wnd,false)
guiSetInputEnabled(true)
showCursor(true)
elseif source == Close_BTN then
guiSetVisible(EdarahWindow,false)
guiSetVisible(wnd,true)
guiSetInputEnabled(false)
showCursor(true)
end
end
end
)




addEventHandler("onClientGUIClick", root, 
function ()
if source == SendBTN then
local Text = guiGetText(SendEdit)
if Text == "" or Text == " " then return end
triggerServerEvent("SendMessage", localPlayer, Text)
Row = guiGridListAddRow ( gridNews )

aText = guiGridListGetItemText ( gridNews , Row , 1 )
triggerServerEvent ( 'Event' , localPlayer , aText )
end
end
)

addEvent("RequestMessage", true)
addEventHandler("RequestMessage", root,
function (Text)
local Row = guiGridListAddRow(gridNews)
local Msg = guiGetText(SendEdit)
guiGridListSetItemText (gridNews, Row, 1, ""..Msg.."", false, false)
guiGridListSetItemColor(gridNews, Row, 1, 0, 255, 0)
end
)

Server

addEvent("SendMessage", true)
addEventHandler("SendMessage", root,
function (TextX)
triggerClientEvent(root, "RequestMessage", source, TextX)
end)

local database = dbConnect ( "sqlite", "MSG_DB.db" )
dbExec ( database, "CREATE TABLE IF NOT EXISTS `MSG` (`TXT`)")

saveTheMessage = function ( text )
	if text then
		local db = dbPoll ( dbQuery ( database, "SELECT * FROM `MSG`" ), -1 )
		if #db > 0 then
			dbExec ( database, "UPDATE `MSG` SET `TXT`=?", tostring(text) )
		else
			dbExec ( database, "INSERT INTO `MSG` VALUES(?)", tostring(text) )
		end		
	end
end

getTheMessage = function ( )
	local message = ""
	local db = dbPoll ( dbQuery ( database, "SELECT * FROM `MSG`" ), -1 )
	if #db > 0 then
		message = tostring(db[1].TXT)
	end
	return message
end

addEvent('Event', true )
addEventHandler('Event' , getRootElement ( ) ,
function ( aText )
    saveTheMessage ( aText )
end )

 

Link to comment
  On 08/12/2016 at 14:32, Master_MTA said:

مودلر بالميتا كونف

دقايق اجبلك صفحة الويكي+

لازم تحمل الملف حقه

+

تفرق من جهاز لجهاز حسب نظام تشغيله

لينيكس

او ويندوز

بالنسبه للينكيس تفضل

https://linux.multitheftauto.com/

وندوز نفس النظام

Expand  

حملت الملفات الحين, حق الـ 

mysql 

طلع بـ صيغة oc 

او شئ زي كذا

Link to comment
  On 08/12/2016 at 15:15, #Soking said:

مايظهر لانك , ماسترجعت الكلام من السي كيو ال ,

ورجعت حطيته بالجريد ليست ضض

Expand  

ضض معليش خذني علي قد عقلي ومعلوماتي فـ البرمجة, لاهنت اذا تقدر ترسلي الكود الصحيح او الاكواد كاملة فـ الخاص او هنا

فـ بكون مشكور لك

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