ShayF2 Posted March 18, 2017 Share Posted March 18, 2017 I'm working on an advanced groups system, Here is a clip of what I already have done. I plan on adding a GUI in the future. Spoiler groups = {} addEventHandler('onResourceStart',resourceRoot,function() loadAndUpdateGroups() end) function loadTeams() for ii,gg in pairs(groups) do for iii,ggg in pairs(getElementsByType('team')) do if getTeamName(ggg) == gg[1] then destroyElement(ggg) end end createTeam(gg[1],unpack(gg['color'])) end end function loadAndUpdateGroups() if not fileExists('groups.json') then local file = fileOpen('groups.json') end local file = fileOpen('groups.json') fileWrite(file,toJSON(groups)) fileClose(file) local file = fileOpen('groups.json') local size = fileGetSize(file) local buffer = fileRead(file,size) groups = fromJSON(buffer) fileClose(file) outputChatBox('Group data saved successfully!',root,0,255,255) end setTimer(loadAndUpdateGroups,10000,0) function getPlayerGroup(player) local serial = getPlayerSerial(player) for e,y in pairs(groups) do for ee,yy in pairs(y['members']) do if yy == serial then return y[1] end end end end function getPlayerGroupRank(player) local serial = getPlayerSerial(player) local group = getPlayerGroup(player) if group then return groups[group]['members'][serial][1] end end function createGroup(player,cmd,name,r,g,b) if getPlayerRank(player,"Admin") or getPlayerGroup(player) then local r,g,b = tonumber(r),tonumber(g),tonumber(b) if name then if r then if g then if b then groups[name] = {} groups[name]['color'] = {r,g,b} outputChatBox('Group created successfully!',player,0,255,255) else groups[name] = {} groups[name]['color'] = {r,g,0} outputChatBox('Group created successfully!',player,0,255,255) end else groups[name] = {} groups[name]['color'] = {r,0,0} outputChatBox('Group created successfully!',player,0,255,255) end else groups[name] = {} groups[name]['color'] = {255,0,0} outputChatBox('Group created successfully!',player,0,255,255) end end loadTeams() loadAndUpdateGroups() end end addCommandHandler('gcreate',createGroup) function addToGroup(player,cmd,other) if other then if getPlayerRank(player,"Admin") then local otherPlayer = getPlayerFromPartialName(other) if otherPlayer then local team = getTeamName(getPlayerTeam(player)) if groups[team] then local serial = getPlayerSerial(otherPlayer) for u,n in pairs(groups[team]) do if not n == serial then table.insert(groups[team],serial) end end end end end end end addCommandHandler('gadd',addToGroup) Link to comment
NeXuS™ Posted March 19, 2017 Share Posted March 19, 2017 Can a moderator move this to Resources? @Dutchman101, @JR10. Link to comment
ShayF2 Posted March 19, 2017 Author Share Posted March 19, 2017 Honestly, you guys are dicks. Like half this :~ doesn't even matter to you. If you wanna be that way then you shouldn't do it here. This is a place were people ask for help and show off what they got. That's commonly what this forum is used for. So I'll rebel, against forum rules, keep this post here. Link to comment
NeXuS™ Posted March 19, 2017 Share Posted March 19, 2017 This section of the forum is asking for help. Not for releasing scripts. The resources section is for this. @jhxp Link to comment
ShayF2 Posted March 19, 2017 Author Share Posted March 19, 2017 This is not a finished script. I'd like help on it, but making a post wouldn't matter because half the people on here look at them and then never reply. Would you mind telling me what this says? Link to comment
NeXuS™ Posted March 19, 2017 Share Posted March 19, 2017 Is it a working script? Yes, it is. You just released it as a not finished script, and this section is not for this. This is asking for help, when a script is not working as it should, or it's not working at all. (Not finished script, but still at Resources, because this is how it should be.) What help does this script need? Link to comment
ShayF2 Posted March 19, 2017 Author Share Posted March 19, 2017 Just now, NeXuS™ said: Is it a working script? Yes, it is. You just released it as a not finished script, and this section is not for this. This is asking for help, when a script is not working as it should, or it's not working at all. (Not finished script, but still at Resources, because this is how it should be.) What help does this script need? "All Lua scripting topics related to Multi Theft Auto" Link to comment
NeXuS™ Posted March 19, 2017 Share Posted March 19, 2017 This is not a scripting topic, this is a show off of one of your resources. Link to comment
ShayF2 Posted March 19, 2017 Author Share Posted March 19, 2017 1 minute ago, NeXuS™ said: This is not a scripting topic, this is a show off of one of your resources. It is a script, it contains Lua code. Therefor it belongs in the SCRIPTING topic.. Link to comment
NeXuS™ Posted March 19, 2017 Share Posted March 19, 2017 Jees, let this for moderators, aight? Link to comment
ShayF2 Posted March 19, 2017 Author Share Posted March 19, 2017 And since it is not finished, it cannot be considered a resource. Link to comment
NeXuS™ Posted March 19, 2017 Share Posted March 19, 2017 (edited) Finished it here, because you cannot understand what this section of the forum is for. Edited March 19, 2017 by NeXuS™ 1 Link to comment
Gordon_G Posted March 19, 2017 Share Posted March 19, 2017 Damn is he a kid to react like this ? You did not ask any help so, we undestand it is finish, that's all. Link to comment
MTA Anti-Cheat Team Dutchman101 Posted March 20, 2017 MTA Anti-Cheat Team Share Posted March 20, 2017 (edited) @shay103 This is a progress show-off, even when it's not finished yet that belongs in the Resources section. It would only be appropiate for Scripting section if you also ask a set of concrete scripting questions on how to proceed/finish it, which you didn't. There's no need for that attitude, and those reporting the post to be moved were right. I suggest you cut off this argument or else it will be locked, and hope that you understand better now you're not right. No more fights after this (my) comment. Edited March 20, 2017 by Dutchman101 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