Jump to content

iPrestege

Members
  • Posts

    10,056
  • Joined

  • Last visited

  • Days Won

    27

Everything posted by iPrestege

  1. This is right? local Name = guiGridListGetItemText(Panel.gridlist[1], guiGridListGetSelectedItem(Panel.gridlist[1]), 1) local IP = guiGridListGetItemText(Panel.gridlist[1], guiGridListGetSelectedItem(Panel.gridlist[1]), 2) local Port = guiGridListGetItemText(Panel.gridlist[1], guiGridListGetSelectedItem(Panel.gridlist[1]), 3) local Type = guiGridListGetItemText(Panel.gridlist[1], guiGridListGetSelectedItem(Panel.gridlist[1]), 4) because its not working too no errors
  2. I Change it to : triggerServerEvent("RemoveServer",localPlayer,Name,IP,Port,Type) but not work not delete the text from the gridlist .
  3. @ Solid Snake sorry for that but i have problem here : addEvent("RemoveServer", true) addEventHandler("RemoveServer", root, function(Name,IP,Port,Type) executeSQLQuery("DELETE FROM `MySql` WHERE `ServerName` = '" .. tostring(Name) .. "' AND ServerIP = '" .. tostring(IP) .. "' AND ServerPort = '" .. tostring(Port) .. " ' AND ServerType = '" .. tostring(Type) .. "'") end ) debugscript say nothing ? Client : xMainFunctions_ = function ( ) local row = guiGridListAddRow(Panel.gridlist[1]) local Name = guiGridListGetItemText(Panel.gridlist[1],row,1) local IP = guiGridListGetItemText(Panel.gridlist[1],row,2) local Port = guiGridListGetItemText(Panel.gridlist[1],row,3) local Type = guiGridListGetItemText(Panel.gridlist[1],row,4) if ( source == Panel.button[1] ) then triggerServerEvent("RedictPlayer",localPlayer,IP,Port) elseif ( source == Panel.button[2] ) then guiSetVisible(Panel.Window[1],false) guiSetVisible(Panel.Window[2],true) showCursor(true) elseif ( source == Panel.button[3] ) then triggerServerEvent("RemoveServer",localPlayer) elseif ( source == Panel.button[4] ) then if ( ServerName ~= "" and ServerIP ~= "" and ServerPort ~= "" and ServerType ~= "" ) then triggerServerEvent("Save:To:Data:Base",localPlayer,guiGetText(ServerName),guiGetText(ServerIP),guiGetText(ServerPort),guiGetText(ServerType)) guiSetVisible(Panel.Window[2],false) showCurosr(false) else outputChatBox("* There was an error check spaces !!",255,0,0,true) end end end addEventHandler("onClientGUIClick",root,xMainFunctions_)
  4. Thank You Work's Great You Are The Best SolidSnake ( ;
  5. No error's but when i press the button that should add the text to the grid i get this in the grid : userdata: 00020626 what's the wrong | = .
  6. SolidSnake what's the wrong in my script : server : addEventHandler("onResourceStart", resourceRoot, function() executeSQLQuery("CREATE TABLE IF NOT EXISTS MySql (ServerName,ServerIP,ServerPort,ServerType)") end ) function setMySql(ServerName,ServerIP,ServerPort,ServerType) return executeSQLQuery("INSERT INTO `MySql` ('ServerName','ServerIP','ServerPort',ServerType') VALUES ('" .. tostring(ServerName) .. "', '" .. tostring(ServerIP) .. "', '" .. tostring(ServerPort) .. ", '" .. tostring(ServerType) .. "'')") end function SelectFromSql() local data = executeSQLQuery("SELECT * FROM MySql") if (type(data) == "table" and #data == 0) or not data then return {} else return data end end function UpDateListInSql(element) if not isElement(element) then return end local Upsql = SelectFromSql() local onClientSqlList = {} for i,UpDateSql in ipairs(Upsql) do table.insert(onClientSqlList, {ServerName = UpDateSql.ServerName, ServerIP = UpDateSql.ServerIP, ServerPort = UpDateSql.ServerPort, ServerType = UpDateSql.ServerType}) end triggerClientEvent(element,"Add",element,onClientSqlList) end addEvent("UpDateAdd", true) addEventHandler("UpDateAdd", root, function() UpDateListInSql(source) end ) addEvent("Save:To:Data:Base", true) addEventHandler("Save:To:Data:Base", root, function(ServerName,ServerIP,ServerPort,ServerType) setMySql(ServerName,ServerIP,ServerPort,ServerType) for i,players in ipairs(getElementsByType("player")) do triggerClientEvent(players,"AddTextToGridList", players,ServerName,ServerIP,ServerPort,ServerType) end end ) -- Client -- Panel = { gridlist = {}, button = {}, label = {}, edit = {}, Window = {}, } local Font = guiCreateFont("font.ttf",11) Panel.Window[1] = guiCreateWindow(37, 109, 420, 358, "==[ R|S ]==", false) guiWindowSetSizable(Panel.Window[1], false) guiSetAlpha(Panel.Window[1], 1.00) guiSetProperty(Panel.Window[1], "CaptionColour", "FFEFFF00") Panel.gridlist[1] = guiCreateGridList(9, 21, 402, 278, false, Panel.Window[1]) guiGridListAddColumn(Panel.gridlist[1], "ServerName", 0.2) guiGridListAddColumn(Panel.gridlist[1], "IP", 0.2) guiGridListAddColumn(Panel.gridlist[1], "Port", 0.2) guiGridListAddColumn(Panel.gridlist[1], "Type", 0.2) Panel.button[1] = guiCreateButton(11, 311, 114, 29, "R", false, Panel.Window[1]) guiSetFont(Panel.button[1], "default-bold-small") guiSetProperty(Panel.button[1], "NormalTextColour", "FF00B9FF") Panel.button[2] = guiCreateButton(154, 311, 114, 29, "Add", false, Panel.Window[1]) guiSetFont(Panel.button[2], "default-bold-small") guiSetProperty(Panel.button[2], "NormalTextColour", "FF65FF00") Panel.button[3] = guiCreateButton(308, 311, 102, 29, "Delete", false, Panel.Window[1]) guiSetFont(Panel.button[3], "default-bold-small") guiSetProperty(Panel.button[3], "NormalTextColour", "FFFF0000") Panel.Window[2] = guiCreateWindow(523, 122, 354, 390, "==[ Add New S ]==", false) guiWindowSetSizable(Panel.Window[2], false) guiSetAlpha(Panel.Window[2], 1.00) guiSetProperty(Panel.Window[2], "CaptionColour", "FF00FFA7") Panel.label[2] = guiCreateLabel(11, 34, 342, 28, "Server Name", false, Panel.Window[2]) guiSetFont(Panel.label[2], "default-bold-small") guiLabelSetColor(Panel.label[2], 255, 0, 0) ServerName = guiCreateEdit(9, 69, 338, 32, "", false, Panel.Window[2]) Panel.label[3] = guiCreateLabel(10, 112, 341, 28, "Server IP", false, Panel.Window[2]) guiSetFont(Panel.label[3], "default-bold-small") guiLabelSetColor(Panel.label[3], 251, 254, 0) ServerIP = guiCreateEdit(10, 145, 333, 32, "", false, Panel.Window[2]) Panel.label[4] = guiCreateLabel(9, 186, 315, 28, "Server Port", false, Panel.Window[2]) guiSetFont(Panel.label[4], "default-bold-small") guiLabelSetColor(Panel.label[4], 0, 209, 254) ServerPort = guiCreateEdit(10, 224, 331, 32, "", false, Panel.Window[2]) Panel.label[5] = guiCreateLabel(13, 263, 305, 28, "Server Type", false, Panel.Window[2]) guiSetFont(Panel.label[5], "default-bold-small") guiLabelSetColor(Panel.label[5], 35, 254, 0) ServerType = guiCreateEdit(10, 291, 331, 32, "", false, Panel.Window[2]) Panel.button[4] = guiCreateButton(27, 338, 290, 37, "Add Server #", false, Panel.Window[2]) guiSetFont(Panel.button[4], "default-bold-small") guiSetProperty(Panel.button[4], "NormalTextColour", "FF00A7FE") xMainFunctions_ = function ( ) if ( source == Panel.button[4] ) then if ( ServerName ~= "" and ServerIP ~= "" and ServerPort ~= "" and ServerType ~= "" ) then triggerServerEvent("Save:To:Data:Base",localPlayer,guiGetText(ServerName),guiGetText(ServerIP),guiGetText(ServerPort),guiGetText(ServerType)) else outputChatBox("* There was an error check spaces !!",255,0,0,true) end end end addEventHandler("onClientGUIClick",root,xMainFunctions_) addEvent("AddTextToGridList", true) addEventHandler("AddTextToGridList", root, function() local row = guiGridListAddRow(Panel.gridlist[1]) guiGridListSetItemText(Panel.gridlist[1], row, 1, tostring(ServerName), false, false) guiGridListSetItemText(Panel.gridlist[1], row, 2, tostring(ServerIP), false, false) guiGridListSetItemText(Panel.gridlist[1], row, 3, tostring(ServerPort), false, false) guiGridListSetItemText(Panel.gridlist[1], row, 3, tostring(ServerType), false, false) guiGridListSetItemColor(Panel.gridlist[1], row, 1, 0, 255, 255) guiGridListSetItemColor(Panel.gridlist[1], row, 2, 0, 255, 255) guiGridListSetItemColor(Panel.gridlist[1], row, 3, 0, 255, 255) guiGridListSetItemColor(Panel.gridlist[1], row, 4, 0, 255, 255) end ) addEvent("Add", true) addEventHandler("Add", root, function(onClientSqlList) guiGridListClear(Panel.gridlist[1]) for k,v in ipairs(onClientSqlList) do local row = guiGridListAddRow(Panel.gridlist[1]) guiGridListSetItemText(Panel.gridlist[1], row, 1, tostring(ServerName), false, false) guiGridListSetItemText(Panel.gridlist[1], row, 2, tostring(ServerIP), false, false) guiGridListSetItemText(Panel.gridlist[1], row, 3, tostring(ServerPort), false, false) guiGridListSetItemText(Panel.gridlist[1], row, 4, tostring(ServerType), false, false) guiGridListSetItemColor(Panel.gridlist[1], row, 1, 0, 255, 255) guiGridListSetItemColor(Panel.gridlist[1], row, 2, 0, 255, 255) guiGridListSetItemColor(Panel.gridlist[1], row, 3, 0, 255, 255) guiGridListSetItemColor(Panel.gridlist[1], row, 4, 0, 255, 255) end end ) addEventHandler("onClientResourceStart", resourceRoot, function() triggerServerEvent("UpDateAdd", localPlayer) end ) Database queary failed near "") VALUES ("": syntax error My friend help me some what . but i need help from you guys too am new in sql .
  7. Hi Guys , Is there a way to save the text in the gridlist? Using the database? Such as this as an example? xMainFunctions_ = function ( ) local Row = guiGridListAddRow(Panel.gridlist[1]) local ServerName = guiGetText(Panel.edit[1]) local ServerIP = guiGetText(Panel.edit[2]) local ServerPort = guiGetText(Panel.edit[3]) local ServerType = guiGetText(Panel.edit[4]) local theText = guiGridListGetItemText(Panel.gridlist[1],Row,1) local theTextt = guiGridListGetItemText(Panel.gridlist[1],Row,2) local theTexttt = guiGridListGetItemText(Panel.gridlist[1],Row,3) if ( source == Panel.button[4] ) then if ( ServerName ~= "" and ServerIP ~= "" and ServerPort ~= "" and ServerType ~= "" ) then guiGridListSetItemText(Panel.gridlist[1],Row,1,ServerName,false,false) guiGridListSetItemText(Panel.gridlist[1],Row,2,ServerIP,false,false) guiGridListSetItemText(Panel.gridlist[1],Row,3,ServerPort,false,false) guiGridListSetItemText(Panel.gridlist[1],Row,4,ServerType,false,false) guiGridListSetItemColor(Panel.gridlist[1],Row,1,255,255,0) guiGridListSetItemColor(Panel.gridlist[1],Row,2,255,0,0) guiGridListSetItemColor(Panel.gridlist[1],Row,3,0,255,0) guiGridListSetItemColor(Panel.gridlist[1],Row,4,0,255,255) guiSetFont(Panel.gridlist[1],Font) triggerServerEvent("Save:To:Data:Base",localPlayer,theText,theTextt,theTexttt) else outputChatBox("* There was an error check spaces !!",255,0,0,true) end end end addEventHandler("onClientGUIClick",root,xMainFunctions_) i mean there's way to save it if player quit and join again or restart the resource?even the "XML" I don't like it . I want that functions should i use it to save it use "SQL" and events that i need . Thanks Guys .
  8. مممن جد وصصلها لـ شيء ثثثاني
  9. الله يعافيك في خدمتكم ي الغالي #
  10. No becuase in the server side i set it if the player not admin set the data to nil .
  11. -- Server -- addEventHandler( 'onPlayerLogin', root, function( _, acc ) if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( "Admin" ) ) then setElementData( source, 'OpenPanel', true) else setElementData( source, 'OpenPanel', nil) end end ) addEventHandler( 'onPlayerJoin', root, function() setElementData( source, 'OpenPanel', nil) end ) -- Client -- bindKey(Key,"down", function () if getElementData( localPlayer, 'OpenPanel') ~= nil then guiSetVisible(fereastra,not guiGetVisible(fereastra)); showCursor(guiGetVisible(fereastra)); if ( guiGetVisible(fereastra) == true ) then guiLabelSetColor(GUIEditor.label[5],math.random(0, 255), math.random(0, 255), math.random(0, 255)) end end end )
  12. -- Client -- xShowPanelFunction_ = function () guiSetVisible(fereastra,not guiGetVisible(fereastra)); showCursor(guiGetVisible(fereastra)); if ( guiGetVisible(fereastra) == true ) then guiLabelSetColor(GUIEditor.label[5],math.random(0, 255), math.random(0, 255), math.random(0, 255)) end end bindKey(Key,"down",xShowPanelFunction_); addEventHandler("Show",root,xShowPanelFunction_); addEvent("Show",true); -- Server -- CheckAdminFunction_ = function ( ) if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Admin" ) ) then triggerClientEvent("Show",source); end end addEventHandler("onPlayerLogin",root,CheckAdminFunction_); logout and login again .
  13. No it's not right u should to use triggerClientEvent isObject > server only!
  14. iPrestege

    help

    You're Welcome .
  15. iPrestege

    help

    Try this ; addEvent("freeze.btn",true) addEventHandler("freeze.btn",root, function ( kick ) local kicked = getPlayerFromName ( kick ); if ( kicked ) then setElementFrozen(kicked,not isElementFrozen(kicked)); end end );
  16. You Can Do All That Using : createTeam spawnPlayer But I have a question! How do you using this functions?Using a button? Or what?
  17. Well let's be clear over what you are trying to do?
  18. No it's not ! this function just create team read the wiki : createTeam
  19. No it's not! for example : local team = createTeam("teamName",r,g,b)
×
×
  • Create New...