Master_11

Members
  • Content Count

    37
  • Joined

  • Last visited

Everything posted by Master_11

  1. I tried it, MrTasty and thanks it worked fine but the problem I face now is triggerClientEvent. This gives me an error of [Expected string at argument 1, got nil] Here is my script Client: function OutputAdminList(list) adminlist = list guiGridListClear(AccountList) local acclist = {} for k in pairs(adminlist) do table.insert(acclist, k) end table.sort(acclist) for i, k in ipairs(acclist) do local name = accName local row = guiGridListAddRow(AccountList, accName) end end addEvent("GetAdminList", true) addEventHandler("GetAdminList", resourceRoot, OutputAdminList) Server: function OutputAdminList(player) local adminlist = {} local group = aclGetGroup("Admin") if (not group) then return false end for i, object in ipairs(aclGroupListObjects(group) or {}) do local objType = gettok(object, 1, string.byte('.')) if (objType == "user") then local name = gettok(object, 2, string.byte('.')) table.insert(adminlist, name) end end triggerClientEvent(client, "GetAdminList", source, adminlist) end addCommandHandler("adminpanel", OutputAdminList)
  2. Hi, I am facing a problem in making this small script, well my Idea is to show all the accounts added in an ACL group to a GUI grid list, for example group 'admin' and I want all the account Names present in that ACL group to show in the grid list even if the player is offline. Client: function GetAccList(accName) if (not accName) then return false end local acsrow = guiGridListAddRow(AccountList) guiGridListSetItemText(AccountList, acsrow, accNameCol, accName, false, false) guiGridListSetItemText(AccountList, acsrow, accNameCol, plrName, false, false) end addEvent("GetACSList", true) addEventHandler("GetACSList", root, GetAccList) Server: function OutputaccList(client, accName, plrName) local ACSList = {} local accountTable = getAccounts() for theKey, theAccount in pairs (accountTable) do local thePlayer = getAccountPlayer(theAccount) accountname = getAccountName(getPlayerAccount(thePlayer)) if (not isObjectInACLGroup("user."..accountname, aclGetGroup("Admin"))) then return false end local plrName = getPlayerName(thePlayer) local accName = accountname ACSList[accName] = plrname end triggerClientEvent(client, "GetACSList", source, ACSList) end addCommandHandler("adminpanel", OutputaccList) To open the panel the command is same "adminpanel".
  3. Thanks, everyone for helping! Moderator may lock this topic.
  4. Could not find the modify buttons ~ So; @ShyF while working on JSON, I found an error on your code, just mentioning if someone could not figure it out in near future. It's fileWrite(file, toJSON(data)) Not fileWrite(toJSON(data),file)
  5. I already started working with JSON, I'll update this topic if I face any problem with the code, thanks ShyF and IIYAMA. You guys helped me a lot.
  6. Didn't really got what you guys meant, can you give me a small example?
  7. I successfully converted it into a GUI, now the problem I face is that when I restart the script the stuff added to the table by the GUI gets removed from the table. how can I solve that, like something which can save the table after every 24 hours or something?
  8. My Sincere apology, I got confused! and thanks! it is working well and fine, but If I may ask, is it possible to show the existing table into a GUI?
  9. Not working, I tried it You must use something to check the table name in which you want to add the line.
  10. Hi everyone, I am facing a small problem with tables, well I am not sure how to add something to a table by using addCommandHandler. Like, if this is my table local random = { -- x = y ['a'] = 'Two', ['b'] = 'One', ['c'] = 'Ten', } Then how can I add another line to this table by a command (addCommandHandler) For example If the command is "/add Q A" ~~~ ("/add d six") then it should add a new line to the table like -> local random = { ['a'] = 'Two', ['b'] = 'One', ['c'] = 'Ten', ['d'] = 'Six', } On the other hand, I have something like this in my mind for the command: local random = { -- x = y ['a'] = 'Two', ['b'] = 'One', ['c'] = 'Ten', ['d'] = 'Six', } function addabcdtotable(client, commandName, x, y) if (blabla ~= "18") then return false end if (x) then return false end --(Checks if (['d'] = 'Six',) already exists, if yes then it will simply return {where x = column and y = column-2}) Add-> (x,y) --(This will add {['d'] = 'Six',} to the table) end addCommandHandler("add", addabcdtotable) --For removing a line from table -> function removeabcdfromtable(client, commandName, x, y) if (blabla ~= "18") then return false end if (x) then --(Checks if (['d'] = 'Six',) already exists, if yes then it will be removed from the table {where x = column-1 and y = column-2) Remove-> (x, y) --(This will remove the whole line and fix the gap ['d'] = 'Six',) else return false end end end addCommandHandler("rem", removeabcdfromtable) -- NOW VERY IMPORTANT THE D IS ONLY THE EXAMPLE IT CAN BE ANYTHING LIKE (['ab'] = 'CD',) etc.. {X and Y is not the position please...}
  11. Thanks, your code is working fine but, can you make it so when the player hit the marker, the player will be teleported to the given x y z by the command like /pmr x y z > Where x y z are the coordinates where the player will be teleported. Also, a command to delete all the markers together and also delete them 1 by 1 local pathMarkers = {} function pathMarker( thePlayer ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then x, y, z = getElementPosition ( thePlayer ) local path = createMarker ( x, y-2, z+1, "arrow", 1.3, 0, 60, 255 ) setElementDimension ( path, 336 ) setElementInterior ( path, 0 ) pathMarkers[#pathMarkers+1] = path outputChatBox ( "Path Marker Created", thePlayer, 60, 255, 60, true ) else outputChatBox ( "Error", thePlayer, 200, 10, 10, true ) end end addCommandHandler( "pmr", pathMarker ) -------------------------------------------------------------------- function setArna ( thePlayer ) if (getElementDimension (thePlayer) ~= 336) then return false end x, y, z = getElementPosition(path) setElementPosition ( thePlayer, x+80, y-20, z+100 ) end addEventHandler ("onMarkerHit", path, setArna) function setArnaA ( thePlayer ) if (getElementDimension (thePlayer) ~= 336) then return false end x, y, z = getElementPosition(path) setElementPosition ( thePlayer, x-200, y, z+1 ) end addEventHandler ("onMarkerHit", path1, setArnaA) function setArnaB ( thePlayer ) if (getElementDimension (thePlayer) ~= 336) then return false end x, y, z = getElementPosition(path) setElementPosition ( thePlayer, x-90, y-90, z+100 ) end addEventHandler ("onMarkerHit", path2, setArnaB) ---------------------------------------------------------------------------------- function delMarkerall ( thePlayer, command ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then setElementPosition (path, 0,0,-50) setElementPosition (path1, 0,0,-50) setElementPosition (path2, 0,0,-50) outputChatBox ( "Markers deleted", thePlayer, 10, 255, 255, true ) else outputChatBox ( "WTF are you up to?", thePlayer, 10, 255, 255, true ) end end addCommandHandler("dallpmr", delMarkerall) function delpmr ( thePlayer, command ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then setElementPosition (path, 0,0,-50) outputChatBox ( "Path marker '1' deleted", thePlayer, 10, 255, 255, true ) else outputChatBox ( "WTF are you up to?", thePlayer, 10, 255, 255, true ) end end addCommandHandler("delpmr", delpmr) function delpmrA ( thePlayer, command ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then setElementPosition (path1, 0,0,-50) outputChatBox ( "Path marker '2' deleted", thePlayer, 10, 255, 255, true ) else outputChatBox ( "WTF are you up to?", thePlayer, 10, 255, 255, true ) end end addCommandHandler("delpmr1", delpmrA) function delpmrB ( thePlayer, command ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then setElementPosition (path2, 0,0,-50) outputChatBox ( "Path marker '3' deleted", thePlayer, 10, 255, 255, true ) else outputChatBox ( "WTF are you up to?", thePlayer, 10, 255, 255, true ) end end addCommandHandler("delpmr2", delpmrB) Here is the full code!
  12. path = createMarker ( 0,0,-50, "arrow", 1.3, 0, 60, 255 ) path1 = createMarker ( 0,0,-50, "arrow", 1.3, 0, 60, 255 ) path2 = createMarker ( 0,0,-50, "arrow", 1.3, 0, 60, 255 ) function pathMarker ( thePlayer, command ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then x, y, z = getElementPosition ( thePlayer ) setElementPosition ( path, x, y-2, z+1 ) setElementDimension ( path, 336 ) setElementInterior ( path, 0 ) outputChatBox ( "Path Marker Created", thePlayer, 60, 255, 60, true ) else outputChatBox ( "Error", thePlayer, 200, 10, 10, true ) end end addCommandHandler ("pmr", pathMarker) function pathMarkerA ( thePlayer, command ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then x, y, z = getElementPosition ( thePlayer ) setElementPosition ( path1, x, y-2, z+1 ) setElementDimension ( path1, 336 ) setElementInterior ( path1, 0 ) outputChatBox ( "Path Marker Created", thePlayer, 60, 255, 60, true ) else outputChatBox ( "Error", thePlayer, 200, 10, 10, true ) end end addCommandHandler ("pmr1", pathMarkerA) function pathMarkerB ( thePlayer, command ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then x, y, z = getElementPosition ( thePlayer ) setElementPosition ( path2, x, y-2, z+1 ) setElementDimension ( path2, 336 ) setElementInterior ( path2, 0 ) outputChatBox ( "Path Marker Created", thePlayer, 60, 255, 60, true ) else outputChatBox ( "Error", thePlayer, 200, 10, 10, true ) end end addCommandHandler ("pmr2", pathMarkerB) Can anyone help me making this code in a table, I want to make the script loop instead of using multiple functions is it possible to make it only on 1 function. for example: Using the command "pmr" to create multiple markers not only 1 marker, Same goes with the other two markers.