BigDaddy Posted September 2, 2015 Share Posted September 2, 2015 (edited) hi guys , i want to make report like this if anyone write subject in edit and text in the memo and click send like then the subject put in gridlist and when anyone click open and select subject name in the gridlist he open to him window and put in the edit the subject and text in the memo that who write it when he send like this : Edited September 3, 2015 by Guest Link to comment
JR10 Posted September 2, 2015 Share Posted September 2, 2015 Can you? How would we know? Link to comment
BigDaddy Posted September 3, 2015 Author Share Posted September 3, 2015 sorry , i mean how i can do it Link to comment
BigDaddy Posted September 3, 2015 Author Share Posted September 3, 2015 anyone can help me please ? Link to comment
JR10 Posted September 3, 2015 Share Posted September 3, 2015 Script the GUI and use triggerServerEvent on click to send the data server-side. We're not going to script it for you. Link to comment
BigDaddy Posted September 4, 2015 Author Share Posted September 4, 2015 WTF i want function that i should use it to make this i made THE GUI AND EVERYTHINK !! Link to comment
kikos500 Posted September 4, 2015 Share Posted September 4, 2015 So you scripted the buttons already if yes then Use this triggerServerEvent triggerClientEvent Link to comment
JR10 Posted September 4, 2015 Share Posted September 4, 2015 You'll have to store the reports in a table, send that table client-side and then populate the gridlist. Link to comment
BigDaddy Posted September 4, 2015 Author Share Posted September 4, 2015 i make it but there is error in insert when i write in subject edit Test and then click button send debugscript say to me : ERROR: Test\server.lua:15: Database query failed: no such table: 'Test' addEventHandler("onClientGUIClick",root, function() if ( source == Send ) then local tSubject = guiGetText(SendSubject) local tMeMo = guiGetText(SendMemo) local tPlrName = getPlayerName(localPlayer) if (tSubject and tSubject ~= "" or tSubject ~= " " and tMeMo ~= "" or tMeMo ~=" ") then triggerServerEvent("INSERT",localPlayer,tPlrName,tSubject,tMeMo) end end end ) addEventHandler("onResourceStart",resourceRoot, function() local AllReports = executeSQLQuery ('CREATE TABLE IF NOT EXISTS `AllReports` ( PlrName , Subject ) ') if ( AllReports ) then outputDebugString("Sucsesfully Create SQL Table 'AllReports'") end end ) addEvent("INSERT",true) addEventHandler("INSERT",root, function ( PlrName , tSubject , tMemo ) executeSQLQuery("CREATE TABLE IF NOT EXISTS '".. tSubject .."' (PlayerName,Subject,Memo)") outputDebugString("Sucsesfully Create SQL Table Name : ".. tSubject .."") executeSQLQuery ( "INSERT INTO `AllReports` ( PlrName , Subject ) VALUES(?,?)",PlrName,tSubject) executeSQLQuery ( "INSERT INTO `'".. tSubject .."'` ( PlayerName,Subject,Memo ) VALUES(?,?,?)",PlrName,tSubject,tMemo) outputChatBox("#FFF000Sucsesfully Send Report [ #00FF00".. tSubject .."#FFF000 ] To Servre Owner",source,255,255,255,true) end ) Link to comment
TAPL Posted September 4, 2015 Share Posted September 4, 2015 addEventHandler("onClientGUIClick", root, function() if source == Send then local tSubject = guiGetText(SendSubject) local tMeMo = guiGetText(SendMemo) local tPlrName = getPlayerName(localPlayer) if tSubject ~= "" and tSubject ~= " " and tMeMo ~= "" and tMeMo ~=" " then triggerServerEvent("INSERT", localPlayer, tPlrName, tSubject, tMeMo) end end end) addEventHandler("onResourceStart", resourceRoot, function() local AllReports = executeSQLQuery("CREATE TABLE IF NOT EXISTS AllReports (PlrName, Subject, Memo)") if AllReports then outputDebugString("Sucsesfully Create SQL Table 'AllReports'") end end) addEvent("INSERT",true) addEventHandler("INSERT", root, function(PlrName, tSubject, tMemo) executeSQLQuery("INSERT INTO AllReports VALUES (?, ?, ?)", PlrName, tSubject, tMemo) outputChatBox("#FFF000Sucsesfully Send Report [ #00FF00"..tSubject.."#FFF000 ] To Servre Owner", source, 255, 255, 255, true) end) Link to comment
BigDaddy Posted September 4, 2015 Author Share Posted September 4, 2015 Debugscript : ERROR: MyTestMode\server.lua:12: Database query failed: table AllReports has no column named Memo My Code : addEventHandler("onResourceStart", resourceRoot, function() local AllReports = executeSQLQuery("CREATE TABLE IF NOT EXISTS AllReports (PlrName, Subject, Memo)") if AllReports then outputDebugString("Sucsesfully Create SQL Table 'AllReports'") end end) addEvent("INSERT",true) addEventHandler("INSERT", root, function(PlrName, tSubject, tMemo) executeSQLQuery("INSERT INTO AllReports (PlrName , Subject , Memo) VALUES (?, ?, ?)", PlrName, tSubject, tMemo) outputChatBox("#FFF000Sucsesfully Send Report [ #00FF00"..tSubject.."#FFF000 ] To Servre Owner", source, 255, 255, 255, true) end) Link to comment
TAPL Posted September 4, 2015 Share Posted September 4, 2015 addEventHandler("onResourceStart", resourceRoot, function() local AllReports = executeSQLQuery("CREATE TABLE IF NOT EXISTS AllReport (PlrName, Subject, Memo)") if AllReports then outputDebugString("Sucsesfully Create SQL Table 'AllReport'") end end) addEvent("INSERT",true) addEventHandler("INSERT", root, function(PlrName, tSubject, tMemo) executeSQLQuery("INSERT INTO AllReport VALUES (?, ?, ?)", PlrName, tSubject, tMemo) outputChatBox("#FFF000Sucsesfully Send Report [ #00FF00"..tSubject.."#FFF000 ] To Servre Owner", source, 255, 255, 255, true) end) Link to comment
BigDaddy Posted September 4, 2015 Author Share Posted September 4, 2015 thank you TAPL can i create table sql with name that i write it in edit ? i mean like this addEventHandler("onClientGUIClick",root, function() if ( source == Create ) then triggerServerEvent("CreateTable",localPlayer,guiGetText(Edit)) end end ) addEvent("CreateTable",true) addEventHandler("CreateTable",root, function(Name) executeSQLQuery("CREATE TABLE IF NOT EXISTS '".. Name .."' (PlayerAccount,PlayerName,Rank)") end ) Link to comment
BigDaddy Posted September 4, 2015 Author Share Posted September 4, 2015 because i want to make clan system like group system addEventHandler("onClientGUIClick",root, function() if ( source == Create ) then if ( guiGetText(EditClanNameToCreate) ~= "" or guiGetText(EditClanNameToCreate) ~= " ") then triggerServerEvent("Create",localPlayer,guiGetText(EditClanNameToCreate)) end end end ) addEventHandler("onResourceStart",resourceRoot, function() local AllClansTable = executeSQLQuery ('CREATE TABLE IF NOT EXISTS `AllClansTable` ( ClanName,Members) ') if ( AllClansTable ) then outputDebugString("Sucsesfully Create SQL Table AllClansTable") local CheckWhenLogin = executeSQLQuery("CREATE TABLE IF NOT EXISTS 'CheckHaveClan?' (Account,ClanName)") if ( CheckWhenLogin ) then outputDebugString("Sucsesfully Create SQL Table CheckHaveClan? !") end end end ) addEvent("Create",true) addEventHandler("Create",root, function ( ClanName ) local Results = executeSQLQuery("SELECT * FROM `AllClansTable` WHERE ClanName=?",ClanName) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then local TonumberMembers = 1 executeSQLQuery("CREATE TABLE IF NOT EXISTS '".. ClanName .."' (PlayerAccount,PlayerName,Rank)") outputDebugString("Sucsesfully Create SQL Table Name : ".. ClanName .."") executeSQLQuery ( "INSERT INTO `AllClansTable` ( ClanName , Members ) VALUES(?,?)",ClanName,tonumber(TonumberMembers)) executeSQLQuery ( "INSERT INTO `'".. ClanName .."'` ( PlayerAccount,PlayerName,Rank ) VALUES(?,?,?)",getPlayerAccount(source),getPlayerName(source),"Clan Leader") executeSQLQuery ( "INSERT INTO `CheckHaveClan?` ( Account , ClanName ) VALUES(?,?)",getPlayerAccount(source),ClanName) setAccountData(getPlayerAccount(source),"HaveClan",true) setAccountData(getPlayerAccount(source),"Leader",true) outputChatBox("#FFF000Sucsesfully Created Clan [ #00FF00".. ClanName .."#FFF000 ]",source,255,255,255,true) else outputChatBox("*ERROR : THIS CLAN NAME IS ALREADY EXISTS !",source,255,0,0,true) end end ) addEventHandler("onPlayerLogin",root, function(_,acc) if ( getAccountData(acc,"HaveClan",true) ) then local CheckResults = executeSQLQuery("SELECT * FROM `CheckHaveClan?` WHERE Account=?",getAccountName(acc)) if ( type ( CheckResults ) == "table" and #CheckResults ~= 0 or CheckResults ) then setElementData(source,"ClanName","".. CheckResults[1]['ClanName'] .."") setElementData(source,"SendToClientHaveClan!",true) end end end ) Link to comment
TAPL Posted September 4, 2015 Share Posted September 4, 2015 http://stackoverflow.com/questions/21273672/many-tables-or-rows-which-one-is-more-efficient-in-sql And maybe you should start learning SQL: http://www.w3schools.com/sql/ Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now