Currently the developers are putting their own money into JC2-MP to keep the servers online.

Please take a few seconds of your time and disable your AdBlock plugin for our website.

Ad revenue is not going to developers, it is used purely for covering our hosting costs.

 

You are also free to donate, which removes all ads from our website!

Patch 0.3 was just released! Full changelog here: https://t.co/4A50m6IKen

2 years ago

Advertisement
August 23, 2019, 11:56:20 pm

Author Topic: [BETA] FactionsPlus 1.0 (AWGFactions Revamp)  (Read 21450 times)

ROODAY

  • Sr. Member
  • ****
  • Posts: 298
    • View Profile
Re: [BETA] FactionsPlus 0.1 (AWGFactions Revamp)
« Reply #30 on: March 02, 2014, 02:03:18 am »
If you want ZED integration I can help there. IZED doesn't really do much JC2 MP stuff anymore, but he gave me access to the repos so I can help you with the API

Esamir

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [BETA] FactionsPlus 0.1 (AWGFactions Revamp)
« Reply #31 on: March 02, 2014, 06:57:27 am »
Hey, thanks for all the suggestions. I'll split your post up and reply to each one.
For Faction Name aliases, you sound like this is mostly to deal with the problem of people creating factions called 'Cops' or 'Reapers' and then others wanting to join the faction and joining 'cops' or 'reapers' instead and thus creating new factions. I found this to be a very annoying problem as it not only created many excess factions, but the Writer side of me hated seeing all that incorrect capitalization(yea, Writers probably shouldn't be scripters, lol). For this reason I added code which forces the first letter to be capitalized whenever it's handling a Faction name. Typing '/f join cops' or '/f join Cops' both put you in the Cops faction. I think this is probably a better remedy than having aliases. A problem I see with a general aliases system is that factions could add tons of names to their alias list and take up popular and desired names and thus not let others use them.
What are your thoughts?
I thought about this too. However, didn't successed. I was thinking also about name shortens: PanauSecretService = alias:PSS. The second purpose. But the first part (case sensetivity) is the main problem.

:) Not sure that being in multiple factions would work very well, though a change I'll be doing soon may allow that ability to be added.
I meant creating multiple factions. Just found after that you made it possible to create empty factions, so no need for that to be discussed.

This MOD displays Faction name and diplomacy stance above the player. It is independent of the NameTags MOD. I don't really see why you would want the Faction name disabled even if you were using ZED. I don't use ZED personally, so you'd have to give an example. It should be easy for me to add an Admin config option to turn them off globally if you'd like.
No-no, not the tag above player, but tag in the chat. You know, on the screenshots there are some things like that: JasonMRC, of FactionPlus: blahblahblah.
ZED's groups has ability to display grouptag before the name: [Administrator]JasonMRC. Whatever, it configures, so there can be even "#$%#@$1337-*JasonMRC". All that stands behind your nick is group tag, a prefix. Very useful.

'/f admin <faction> <command>' ;)
This allows you to use any command as if you were the leader of that faction, only difference is there are only the bare minimum checks for safety's sake so you can do pretty much anything(like setting a color that is already used or setting an RGB color even if they aren't enabled, changing name even if it's not enabled, or changing name to any size regardless of min/max set in config).
It's a pretty comprehensive Admin System. A few examples:
/f admin reapers join Bob - Adds Bob to faction Reapers.
/f admin reapers setpass killpanay - Sets Reapers password to 'killpanay'.
/f admin reapers kick Bob - Kicks Bob from Reapers.
/f admin reapers ban Bob - Bans Bob from Reapers(Poor Bob).
/f admin reapers name Roaches - Changes Reapers name to Roaches(Bolo is gonna be mad).
/f admin reapers diplomacy - Tells you who's Reapers allies and enemies.
/f admin reapers del - Deletes Reapers faction.
There are more commands, but you get the general gist of the system.
Oh. Sorry then, thought it wasn't ready. Good.

GUIs are nice, but I doubt I'll be adding them. It should be fairly easy for someone familiar with GUIs to add a GUI to the system after I release it. I would love to see this and have ideas for it, but I have no experience with GUIs so probably would not do well writing it.
Well, I'll try then, after you will release it.

Again, not familiar with ZED's so you'd have to explain that to me. I could add config options to disable each command on a per command basis, if that is something desired by the community? Admin's are able to create and manage factions entirely so you could remove the player's ability to do so. I could see how this would be beneficial if used on an RP or private server.

I do have a fairly comprehensive permissions system governing Officer commands. Officer commands are basically any Leader command. Due to the new permissions system and advanced ranks system I have changed them to being called Officer Commands.
That's almost it. It doesn't really comes from ZED, but this is the best example. ZED's groups (again) have access levels. Here, for example (from my server's User.txt):
Code: [Select]
{
"permission":["help","getpos","jump","warp","info","tp","rules","motd","pm","w","f"],
"name":"User",
"color":["150","150","150"],
"useprefix":false
}
A basic access, there are permission (allowed commands), user's tag, also it's color and variable to disable it's prefix.
So. Users may create lots of factions, but there is no need to do it. Then, if there is possible, it would be nice to split /f join and /f create, I think. Denying of /f create would not let create new faction, but users will be able to join any faction, for example. Or just send check for user's group via ZEDTunnel and return continue (for /f join NewFaction if is administartor) or false (for /f join NewFaction if isn't administrator).

JasonMRC

  • Donator
  • Hero Member
  • *****
  • Posts: 601
    • View Profile
Re: [BETA] FactionsPlus 0.1 (AWGFactions Revamp)
« Reply #32 on: March 02, 2014, 09:26:51 am »
Hey, thanks for all the suggestions. I'll split your post up and reply to each one.
For Faction Name aliases, you sound like this is mostly to deal with the problem of people creating factions called 'Cops' or 'Reapers' and then others wanting to join the faction and joining 'cops' or 'reapers' instead and thus creating new factions. I found this to be a very annoying problem as it not only created many excess factions, but the Writer side of me hated seeing all that incorrect capitalization(yea, Writers probably shouldn't be scripters, lol). For this reason I added code which forces the first letter to be capitalized whenever it's handling a Faction name. Typing '/f join cops' or '/f join Cops' both put you in the Cops faction. I think this is probably a better remedy than having aliases. A problem I see with a general aliases system is that factions could add tons of names to their alias list and take up popular and desired names and thus not let others use them.
What are your thoughts?
I thought about this too. However, didn't successed. I was thinking also about name shortens: PanauSecretService = alias:PSS. The second purpose. But the first part (case sensetivity) is the main problem.
Hmm. That could probably be done, but again you have the possibility of people claiming aliases that are not even remotely related to them. The only reason I can think of for a shorter name would be for easier joining. I would think you'd want your full name to display on tags and chats.

Quote
This MOD displays Faction name and diplomacy stance above the player. It is independent of the NameTags MOD. I don't really see why you would want the Faction name disabled even if you were using ZED. I don't use ZED personally, so you'd have to give an example. It should be easy for me to add an Admin config option to turn them off globally if you'd like.
No-no, not the tag above player, but tag in the chat. You know, on the screenshots there are some things like that: JasonMRC, of FactionPlus: blahblahblah.
ZED's groups has ability to display grouptag before the name: [Administrator]JasonMRC. Whatever, it configures, so there can be even "#$%#@$1337-*JasonMRC". All that stands behind your nick is group tag, a prefix. Very useful.
Admin config option FactionGlobalChatTitles = true as well as a personal clientside option /factiontitle. If either of these are set to false the Faction Name titles will not display in chat. This feature is designed for the more RP and Faction catered servers where knowing someone's Faction would have meaning. On general freeroams I can see it being disabled.

Quote
GUIs are nice, but I doubt I'll be adding them. It should be fairly easy for someone familiar with GUIs to add a GUI to the system after I release it. I would love to see this and have ideas for it, but I have no experience with GUIs so probably would not do well writing it.
Well, I'll try then, after you will release it.
Look forward to it. You'll know who to contact if you're having trouble with a command or function ;)

Quote
Again, not familiar with ZED's so you'd have to explain that to me. I could add config options to disable each command on a per command basis, if that is something desired by the community? Admin's are able to create and manage factions entirely so you could remove the player's ability to do so. I could see how this would be beneficial if used on an RP or private server.

I do have a fairly comprehensive permissions system governing Officer commands. Officer commands are basically any Leader command. Due to the new permissions system and advanced ranks system I have changed them to being called Officer Commands.
That's almost it. It doesn't really comes from ZED, but this is the best example. ZED's groups (again) have access levels. Here, for example (from my server's User.txt):
Code: [Select]
{
"permission":["help","getpos","jump","warp","info","tp","rules","motd","pm","w","f"],
"name":"User",
"color":["150","150","150"],
"useprefix":false
}
A basic access, there are permission (allowed commands), user's tag, also it's color and variable to disable it's prefix.
So. Users may create lots of factions, but there is no need to do it. Then, if there is possible, it would be nice to split /f join and /f create, I think. Denying of /f create would not let create new faction, but users will be able to join any faction, for example. Or just send check for user's group via ZEDTunnel and return continue (for /f join NewFaction if is administartor) or false (for /f join NewFaction if isn't administrator).
So are those '/<commandhere>' allowances? If so you would need quite a few entries for all the different commands in F+.

I'm going to have to look into the infrastructure of ZED to be able to say whether or not I'll be able to add that. I won't say it's not possible, because I'm sure someone can do it. It's just I've never used ZED so I don't know if F+ will be able to ship with ZED support. I know there's a few on the forums who ask for ZED support for MODs but TBH when I go to other servers I don't see ZED used much. I never started using it because something about it felt 'too controlly'. I know that sounds strange. I think it was the fact that it had to have files in every mod. This seems wrong to me.

But anyways, we're not here to discuss ZED and my personal thoughts heh. ROODAY has offered to help me with adding ZED support so we'll see.

On a changelog related note, the large update regarding changing how names are handled went very well this evening! Previously factions were always identified by their names. This made adding the name change function more difficult as it required changing every allied and enemied faction's ally/enemy list as well as editing every member's faction column. This put a noticeable, though brief, load on the server(I don't think it affected gameplay but the admin could see it in the console). I have switched the system over to using Faction IDs now. These are auto-assigned by the server. Faction names are still the primary thing used in functions, but when going to or from the database or between server and client it is translated to the ID. This allows name changes to be instant. It's also a more efficient way of handling entries in the DB. I don't fault Anzu for using the Name system as it was simple and worked well. However an upgrade was required for the new system. I think(and hope) he would be proud  8)

SonnySalieri

  • Full Member
  • ***
  • Posts: 189
    • View Profile
Re: [BETA] FactionsPlus 0.1 (AWGFactions Revamp)
« Reply #33 on: March 02, 2014, 02:28:52 pm »

Jeez, sonny caln down man. Why do you always have to be upset about everything?
Why dont you read Jason's posts better? He said why you can't have it yet.

Calm down man.. Seriously

Im not mad or anything i just hate when someone doesnt read posts thoroughly.
So why didnt you read my posts more thoroughly too? Check out the bold parts in the next
quotes maybe that'll answer things you've missed to read

And Sonny, leave this man alone, if you're not going to help him code. Ideas are fine, but
fighting to get those ideas through is something you shouldn't do. He might not have the
time of the knowledge to do this (No offense), and I expect that you don't either.

How in hell could i help him code if i dont have the script to look through it to see where
i could add something or not? I'd try to add my ideas to it if i'd have the script but since
i dont have it where should i add anything? this is what i also pointed out in my last post but
i guess u didnt read it thoroughly...so yea nevermind...  And hey i didnt said anything about
his scripting qualities or yours so backoff the knoweledge line dont be a wiseguy...
he's not a time millionaire and neither am i this i also stated in one of my posts so why dont
you read posts more thoroughly?
I think i wont post any more ideas, instead i'll wait till he releases it and see if i can add
them to it afterwards
.

kthxbai

misterff1

  • Donator
  • Hero Member
  • *****
  • Posts: 582
    • View Profile
Re: [BETA] FactionsPlus 0.1 (AWGFactions Revamp)
« Reply #34 on: March 02, 2014, 02:41:42 pm »

Jeez, sonny caln down man. Why do you always have to be upset about everything?
Why dont you read Jason's posts better? He said why you can't have it yet.

Calm down man.. Seriously

Im not mad or anything i just hate when someone doesnt read posts thoroughly.
So why didnt you read my posts more thoroughly too? Check out the bold parts in the next
quotes maybe that'll answer things you've missed to read

And Sonny, leave this man alone, if you're not going to help him code. Ideas are fine, but
fighting to get those ideas through is something you shouldn't do. He might not have the
time of the knowledge to do this (No offense), and I expect that you don't either.

How in hell could i help him code if i dont have the script to look through it to see where
i could add something or not? I'd try to add my ideas to it if i'd have the script but since
i dont have it where should i add anything? this is what i also pointed out in my last post but
i guess u didnt read it thoroughly...so yea nevermind...  And hey i didnt said anything about
his scripting qualities or yours so backoff the knoweledge line dont be a wiseguy...
he's not a time millionaire and neither am i this i also stated in one of my posts so why dont
you read posts more thoroughly?
I think i wont post any more ideas, instead i'll wait till he releases it and see if i can add
them to it afterwards
.

kthxbai


sigh... I DID read your posts, but in those posts I can see that YOU didn't read the posts from Jason.

Now stop it.

Esamir

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [BETA] FactionsPlus 0.1 (AWGFactions Revamp)
« Reply #35 on: March 02, 2014, 02:55:11 pm »
Hmm. That could probably be done, but again you have the possibility of people claiming aliases that are not even remotely related to them. The only reason I can think of for a shorter name would be for easier joining. I would think you'd want your full name to display on tags and chats.
That would be really useful. If there will be a possible way, how about then just not allow players create aliases, but allow this only to admins? In pairs with only-admin faction making it will be great.

Admin config option FactionGlobalChatTitles = true as well as a personal clientside option /factiontitle. If either of these are set to false the Faction Name titles will not display in chat. This feature is designed for the more RP and Faction catered servers where knowing someone's Faction would have meaning. On general freeroams I can see it being disabled.
Yea, this is it, thanks for the information. But one more question: does FactionGlobalChatTitles overrides presonal settings?

So are those '/<commandhere>' allowances? If so you would need quite a few entries for all the different commands in F+.
Yes. But there are global command acces contols: if /f will not be listed, it will never run /f join. I have not tried "/f join", but it seems it is not correct. That's right, we'll need some entries, but these entries must name just a command, not it's arguments.

JasonMRC

  • Donator
  • Hero Member
  • *****
  • Posts: 601
    • View Profile
Re: [BETA] FactionsPlus 0.1 (AWGFactions Revamp)
« Reply #36 on: March 02, 2014, 07:12:09 pm »
Hmm. That could probably be done, but again you have the possibility of people claiming aliases that are not even remotely related to them. The only reason I can think of for a shorter name would be for easier joining. I would think you'd want your full name to display on tags and chats.
That would be really useful. If there will be a possible way, how about then just not allow players create aliases, but allow this only to admins? In pairs with only-admin faction making it will be great.
I'll see what I can come up with. It will require adding another table entry and then checking faction join messages against that...we'll see.

Quote
Admin config option FactionGlobalChatTitles = true as well as a personal clientside option /factiontitle. If either of these are set to false the Faction Name titles will not display in chat. This feature is designed for the more RP and Faction catered servers where knowing someone's Faction would have meaning. On general freeroams I can see it being disabled.
Yea, this is it, thanks for the information. But one more question: does FactionGlobalChatTitles overrides presonal settings?
Yes. If FactionGlobalChatTitles = true then people can't turn them on at all.

Quote
So are those '/<commandhere>' allowances? If so you would need quite a few entries for all the different commands in F+.
Yes. But there are global command acces contols: if /f will not be listed, it will never run /f join. I have not tried "/f join", but it seems it is not correct. That's right, we'll need some entries, but these entries must name just a command, not it's arguments.
So '/f' must be allowed, and then you also must allow certain commands for players like 'join' or 'leave'?
This sounds like it would be a simple thing to do. However /f join currently creates a faction if one by that name does not exist. So currently allowing people to join factions also allows them to create them. I could add a '/f create' that would create a new faction and switch '/f join' to only try to join an existing faction. Most people are used to doing /f join to make a new faction so create would take a little getting used to, however it would prevent accidental faction creations.

Esamir

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [BETA] FactionsPlus 0.1 (AWGFactions Revamp)
« Reply #37 on: March 02, 2014, 07:24:16 pm »
So '/f' must be allowed, and then you also must allow certain commands for players like 'join' or 'leave'?
This sounds like it would be a simple thing to do. However /f join currently creates a faction if one by that name does not exist. So currently allowing people to join factions also allows them to create them. I could add a '/f create' that would create a new faction and switch '/f join' to only try to join an existing faction. Most people are used to doing /f join to make a new faction so create would take a little getting used to, however it would prevent accidental faction creations.
No, /f must be listed in permissions array. For /f (as command) any following words are counted as parameters so /f leave can't be listed in permissions array separated from /f. It's just for ZED's groups. So, if I allow players to use /f command, they will have access to any command parameter for /f. Can not split /f's functions.
As I said before, it would be nice if you will split faction joining and faction creating. About that, here is a good way to post check for admin access (on "create" line). On my mind is also making it like that:
/fcreate <name> <password> <params>
instead of /f create (switching to a new command while /f is another command and it not a part of /fcrate).
However, it is not such a good idea to create a new command for creation.

JasonMRC

  • Donator
  • Hero Member
  • *****
  • Posts: 601
    • View Profile
Re: [BETA] FactionsPlus 0.1 (AWGFactions Revamp)
« Reply #38 on: March 02, 2014, 07:38:10 pm »
So '/f' must be allowed, and then you also must allow certain commands for players like 'join' or 'leave'?
This sounds like it would be a simple thing to do. However /f join currently creates a faction if one by that name does not exist. So currently allowing people to join factions also allows them to create them. I could add a '/f create' that would create a new faction and switch '/f join' to only try to join an existing faction. Most people are used to doing /f join to make a new faction so create would take a little getting used to, however it would prevent accidental faction creations.
No, /f must be listed in permissions array. For /f (as command) any following words are counted as parameters so /f leave can't be listed in permissions array separated from /f. It's just for ZED's groups. So, if I allow players to use /f command, they will have access to any command parameter for /f. Can not split /f's functions.
As I said before, it would be nice if you will split faction joining and faction creating. About that, here is a good way to post check for admin access (on "create" line). On my mind is also making it like that:
/fcreate <name> <password> <params>
instead of /f create (switching to a new command while /f is another command and it not a part of /fcrate).
However, it is not such a good idea to create a new command for creation.
You lost me.
'/f join name' will try to join the faction and if it doesn't exist it will create it. That's how it currently works. The only way currently to prevent player's from creating a faction is to block '/f join', which would effectively disable the whole MOD.
If I made '/f create name' then you could block that command and leave '/f join name' as allowed.

Perhaps you should post some code on how it would look for this system.

...Wait, are you saying ZED controls the first command, and anything beyond that follows the same permissions?
Permission '/f' allows: '/f join', '/f leave' etc,
Permission '/fjoin' would only allow: '/fjoin' but NOT '/f leave'?
I'm thinking the spaces are the big thing you're referring to?

Esamir

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [BETA] FactionsPlus 0.1 (AWGFactions Revamp)
« Reply #39 on: March 02, 2014, 07:52:00 pm »
That's the problem. If even there will be /f create <name>, it will not work. Only first letter matters from here, as it is defined as a command (/f — command, create — parameter of command). It's "technically" so. So, from here, I can not just block /f create using ZED's premissions system.

What code do you mean? Don't really get it, sorry.


Yes, that's right. Spaces are some "indicators" for ZED's chat catches, so it explodes string and selects first non-spaced word beginning from slash as a command and everything that follows it will be defined as first word-command's parameter. That's why there is no such easy way to make it working even in original mod. Only if in script I will define admins and post checks for every command parameter I need.

JasonMRC

  • Donator
  • Hero Member
  • *****
  • Posts: 601
    • View Profile
Re: [BETA] FactionsPlus 0.1 (AWGFactions Revamp)
« Reply #40 on: March 02, 2014, 11:27:46 pm »
That's the problem. If even there will be /f create <name>, it will not work. Only first letter matters from here, as it is defined as a command (/f — command, create — parameter of command). It's "technically" so. So, from here, I can not just block /f create using ZED's premissions system.

What code do you mean? Don't really get it, sorry.

Yes, that's right. Spaces are some "indicators" for ZED's chat catches, so it explodes string and selects first non-spaced word beginning from slash as a command and everything that follows it will be defined as first word-command's parameter. That's why there is no such easy way to make it working even in original mod. Only if in script I will define admins and post checks for every command parameter I need.
By code I mean, write an example permission of how it would look in ZED if the commands were how you want them to be.

But it appears that, in all honesty, ZED is lacking functionality. ZED should be checking what the first command is, validating it, and then checking the next command. It should be able to do this at least three deep. That would remedy the problem.

Standard Command Syntax
Code: [Select]
/f join Reapers
[/f] [join] [Reapers]
[/modulecommand] [functioncommand] [playerinput]
That is the standard way of sending commands. Changing it to /fjoin or /fcreate would be very sloppy and unprofessional. ZED should be able to work with command strings - MODs should not have to be modified to cater for ZED. I will not be changing F+ to operate in a /fcommand style. I can, however, work with you or ROODAY to modify ZED to accept advanced string commands. This is a feature ZED needs if it wishes to remain mainstream compatible. Most MODs with multiple commands use the '/f command input', it's just standard procedure.

I'm not trying to be harsh against you - I hope you understand that - I'm just being honest from a coding aspect. Those changes would require base changes which would affect even those who don't use ZED. It also breaks common practice syntax. I think it would be better all around if ZED was updated to cater to all MODs rather than all MODs having to cater to ZED.

I don't mind working with someone to update ZED. If ROODAY is reading this he can message me else I will probably message him. I don't *think* the required update would be very hard to write, but again, I haven't seen ZED's code.

ROODAY

  • Sr. Member
  • ****
  • Posts: 298
    • View Profile
Re: [BETA] FactionsPlus 0.1 (AWGFactions Revamp)
« Reply #41 on: March 02, 2014, 11:42:43 pm »
It doesn't require one space commands. You just use it as another argument. Here's an example (warning: wall of text):

Code: [Select]
if(strEquals("group", args[1]))then
if(args[2] and args[3])then
if(strFind(args[2], "create"))then
if(GroupExists(args[3]))then
SendChatMessage(ply, Color(200,0,0,255),"Group already exists: " .. args[3])
else
if(FindGroup(args[4]))then
CreateGroup(args[3], {}, FindGroup(args[4]).name)
else
CreateGroup(args[3], {})
end
local str = json():encode(FindGroup(args[3]))
local file = io.open("./data/groups/"..args[3]..".txt", "w")
file:write(str)
file:close()
SendChatMessage(ply, Color(0,200,0,255),"Group created: " .. args[3], Color(0,200,0,255))
end
elseif(strFind(args[2], "delete"))then
if(FindGroup(args[3]))then
local name = FindGroup(args[3]).name
for k,v in pairs(Groups) do
if(strEquals(v.name, name))then
local file = io.open("./data/groups/"..name..".txt", "w")
file:write("Deleted by " .. ply:GetName())
file:close()
Groups[k] = nil
SendChatMessage(ply, Color(0,200,0,255),"Group deleted: " .. name)
break
end
end
else
SendChatMessage(ply, Color(200,0,0,255),"Can't find " .. args[3], Color(200,0,0,255))
end
elseif(strFind(args[2], "addperm"))then
if(FindGroup(args[3]))then
if(not args[4])then
SendChatMessage(ply, Color(200,0,0,255),"Syntax: /group addperm <group> <permission>", Color(200,0,0,255))
return
end
for k,v in pairs(Groups) do
if(v.name == FindGroup(args[3]).name)then
for i,j in pairs(Groups[k].permission) do
if(strEquals(j, args[4]))then
SendChatMessage(ply, Color(200,0,0,255),"This group has already this permission: " .. args[4])
return
end
end
table.insert(Groups[k].permission, args[4])
end
end
local str = json():encode(FindGroup(args[3]))
local file = io.open("./data/groups/"..FindGroup(args[3]).name..".txt", "w")
file:write(str)
file:close()
SendChatMessage(ply, Color(0,200,0,255),"Permission added: " .. args[4])
else
SendChatMessage(ply, Color(200,0,0,255),"Can't find " .. args[3])
end
elseif(strFind(args[2], "delperm"))then
if(FindGroup(args[3]))then
if(not args[4])then
SendChatMessage(ply, Color(200,0,0,255), "Syntax: /group delperm <group> <permission>")
return
end
local found = -1
local group = -1
local perm = ""
for k,v in pairs(Groups) do
if(v.name == FindGroup(args[3]).name)then
group = k
for i,j in pairs(Groups[k].permission) do
if(strFind(j, args[4]))then
found = i
perm = j
end
end
break
end
end
if(found > -1)then
Groups[group].permission[found]=nil
local str = json():encode(FindGroup(args[3]))
local file = io.open("./data/groups/"..FindGroup(args[3]).name..".txt", "w")
file:write(str)
file:close()
SendChatMessage(ply, Color(0,200,0,255),"Permission removed: " .. perm)
else
SendChatMessage(ply, Color(200,0,0,255),"Permission not found: " .. args[4])
end
else
SendChatMessage(ply, Color(200,0,0,255),"Can't find " .. args[3])
end
elseif(strFind(args[2], "setcolor"))then
if(FindGroup(args[3]))then
if (not args[4]) or (not args[5]) or (not args[6]) then
SendChatMessage(ply, Color(200,0,0,255),"Syntax: group setcolor <group> <r> <g> <b>")
return
end
for k,v in pairs(Groups) do
if(v.name == FindGroup(args[3]).name)then
Groups[k].color = {tonumber(args[4]), tonumber(args[5]), tonumber(args[6])}
end
end
local str = json():encode(FindGroup(args[3]))
local file = io.open("./data/groups/"..FindGroup(args[3]).name..".txt", "w")
file:write(str)
file:close()
SendChatMessage(ply, Color(tonumber(args[4]), tonumber(args[5]), tonumber(args[6])),"Color set.")
else
SendChatMessage(ply, Color(200,0,0,255),"Can't find " .. args[3])
end
elseif(strFind(args[2], "toggleprefix"))then
if(FindGroup(args[3]))then
for k,v in pairs(Groups) do
if(v.name == FindGroup(args[3]).name)then
if not Groups[k].useprefix then
Groups[k].useprefix = true
else
Groups[k].useprefix = not Groups[k].useprefix
end
end
end
local str = json():encode(FindGroup(args[3]))
local file = io.open("./data/groups/"..FindGroup(args[3]).name..".txt", "w")
file:write(str)
file:close()
SendChatMessage(ply, Color(0,200,0,255), "Prefix toggled.")
else
SendChatMessage(ply, Color(200,0,0,255), "Can't find " .. args[2])
end
end
else
SendChatMessage(ply, Color(200,0,0,255),"Syntax: /group create <name> <inherits>")
SendChatMessage(ply, Color(200,0,0,255),"Syntax: /group delete <name>")
SendChatMessage(ply, Color(200,0,0,255),"Syntax: /group addperm <group> <permission>")
SendChatMessage(ply, Color(200,0,0,255),"Syntax: /group delperm <group> <permission>")
SendChatMessage(ply, Color(200,0,0,255),"Syntax: /group setcolor <group> <r> <g> <b>")
SendChatMessage(ply, Color(200,0,0,255),"Syntax: /group toggleprefix <group>")
if(#Groups > 0)then
SendChatMessage(ply, Color(0,180,130),"Available Groups:")
local c = 0
local str = ""
for k,v in pairs(Groups) do
c = c + 1
str = str .. ", " .. v.name
if (c == 5)then
c = 0
SendChatMessage(ply, Color(0,200,150),string.sub(str, 3))
str = ""
end
end
if(c > 0)then
SendChatMessage(ply, Color(0,200,150),string.sub(str, 3))
end
end
end
end

TL;DR You can have multi-part commands in ZED. IMO, ZED's the easiest way of writing commands once you learn it.

JasonMRC

  • Donator
  • Hero Member
  • *****
  • Posts: 601
    • View Profile
Re: [BETA] FactionsPlus 0.1 (AWGFactions Revamp)
« Reply #42 on: March 03, 2014, 12:00:35 am »
It doesn't require one space commands. You just use it as another argument. Here's an example (warning: wall of text):

Code: [Select]
if(strEquals("group", args[1]))then
if(args[2] and args[3])then
if(strFind(args[2], "create"))then
if(GroupExists(args[3]))then
SendChatMessage(ply, Color(200,0,0,255),"Group already exists: " .. args[3])
else
if(FindGroup(args[4]))then
CreateGroup(args[3], {}, FindGroup(args[4]).name)
else
CreateGroup(args[3], {})
end
local str = json():encode(FindGroup(args[3]))
local file = io.open("./data/groups/"..args[3]..".txt", "w")
file:write(str)
file:close()
SendChatMessage(ply, Color(0,200,0,255),"Group created: " .. args[3], Color(0,200,0,255))
end
elseif(strFind(args[2], "delete"))then
if(FindGroup(args[3]))then
local name = FindGroup(args[3]).name
for k,v in pairs(Groups) do
if(strEquals(v.name, name))then
local file = io.open("./data/groups/"..name..".txt", "w")
file:write("Deleted by " .. ply:GetName())
file:close()
Groups[k] = nil
SendChatMessage(ply, Color(0,200,0,255),"Group deleted: " .. name)
break
end
end
else
SendChatMessage(ply, Color(200,0,0,255),"Can't find " .. args[3], Color(200,0,0,255))
end
elseif(strFind(args[2], "addperm"))then
if(FindGroup(args[3]))then
if(not args[4])then
SendChatMessage(ply, Color(200,0,0,255),"Syntax: /group addperm <group> <permission>", Color(200,0,0,255))
return
end
for k,v in pairs(Groups) do
if(v.name == FindGroup(args[3]).name)then
for i,j in pairs(Groups[k].permission) do
if(strEquals(j, args[4]))then
SendChatMessage(ply, Color(200,0,0,255),"This group has already this permission: " .. args[4])
return
end
end
table.insert(Groups[k].permission, args[4])
end
end
local str = json():encode(FindGroup(args[3]))
local file = io.open("./data/groups/"..FindGroup(args[3]).name..".txt", "w")
file:write(str)
file:close()
SendChatMessage(ply, Color(0,200,0,255),"Permission added: " .. args[4])
else
SendChatMessage(ply, Color(200,0,0,255),"Can't find " .. args[3])
end
elseif(strFind(args[2], "delperm"))then
if(FindGroup(args[3]))then
if(not args[4])then
SendChatMessage(ply, Color(200,0,0,255), "Syntax: /group delperm <group> <permission>")
return
end
local found = -1
local group = -1
local perm = ""
for k,v in pairs(Groups) do
if(v.name == FindGroup(args[3]).name)then
group = k
for i,j in pairs(Groups[k].permission) do
if(strFind(j, args[4]))then
found = i
perm = j
end
end
break
end
end
if(found > -1)then
Groups[group].permission[found]=nil
local str = json():encode(FindGroup(args[3]))
local file = io.open("./data/groups/"..FindGroup(args[3]).name..".txt", "w")
file:write(str)
file:close()
SendChatMessage(ply, Color(0,200,0,255),"Permission removed: " .. perm)
else
SendChatMessage(ply, Color(200,0,0,255),"Permission not found: " .. args[4])
end
else
SendChatMessage(ply, Color(200,0,0,255),"Can't find " .. args[3])
end
elseif(strFind(args[2], "setcolor"))then
if(FindGroup(args[3]))then
if (not args[4]) or (not args[5]) or (not args[6]) then
SendChatMessage(ply, Color(200,0,0,255),"Syntax: group setcolor <group> <r> <g> <b>")
return
end
for k,v in pairs(Groups) do
if(v.name == FindGroup(args[3]).name)then
Groups[k].color = {tonumber(args[4]), tonumber(args[5]), tonumber(args[6])}
end
end
local str = json():encode(FindGroup(args[3]))
local file = io.open("./data/groups/"..FindGroup(args[3]).name..".txt", "w")
file:write(str)
file:close()
SendChatMessage(ply, Color(tonumber(args[4]), tonumber(args[5]), tonumber(args[6])),"Color set.")
else
SendChatMessage(ply, Color(200,0,0,255),"Can't find " .. args[3])
end
elseif(strFind(args[2], "toggleprefix"))then
if(FindGroup(args[3]))then
for k,v in pairs(Groups) do
if(v.name == FindGroup(args[3]).name)then
if not Groups[k].useprefix then
Groups[k].useprefix = true
else
Groups[k].useprefix = not Groups[k].useprefix
end
end
end
local str = json():encode(FindGroup(args[3]))
local file = io.open("./data/groups/"..FindGroup(args[3]).name..".txt", "w")
file:write(str)
file:close()
SendChatMessage(ply, Color(0,200,0,255), "Prefix toggled.")
else
SendChatMessage(ply, Color(200,0,0,255), "Can't find " .. args[2])
end
end
else
SendChatMessage(ply, Color(200,0,0,255),"Syntax: /group create <name> <inherits>")
SendChatMessage(ply, Color(200,0,0,255),"Syntax: /group delete <name>")
SendChatMessage(ply, Color(200,0,0,255),"Syntax: /group addperm <group> <permission>")
SendChatMessage(ply, Color(200,0,0,255),"Syntax: /group delperm <group> <permission>")
SendChatMessage(ply, Color(200,0,0,255),"Syntax: /group setcolor <group> <r> <g> <b>")
SendChatMessage(ply, Color(200,0,0,255),"Syntax: /group toggleprefix <group>")
if(#Groups > 0)then
SendChatMessage(ply, Color(0,180,130),"Available Groups:")
local c = 0
local str = ""
for k,v in pairs(Groups) do
c = c + 1
str = str .. ", " .. v.name
if (c == 5)then
c = 0
SendChatMessage(ply, Color(0,200,150),string.sub(str, 3))
str = ""
end
end
if(c > 0)then
SendChatMessage(ply, Color(0,200,150),string.sub(str, 3))
end
end
end
end

TL;DR You can have multi-part commands in ZED. IMO, ZED's the easiest way of writing commands once you learn it.
Umm, not knowing where that code goes I can't comment on it but yes, using additional arguments is exactly the update I was saying would be needed. Sounds like ZED already has the required functionality, which I would expect. There must have been a misunderstanding between us or something.

Which if it already supports multiple spaced commands then I shouldn't have to do anything. Unless I am missing something.

ROODAY, since you're the Support Agent for ZED would you be able to tell me either here or in message what, if anything, would be necessary to add ZED support?

Trip[ABK]

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: [BETA] FactionsPlus 0.1 (AWGFactions Revamp)
« Reply #43 on: March 04, 2014, 08:41:01 pm »
fukn sexy! 8)

ahhhhh i want on my server right meow :(

Esamir

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [BETA] FactionsPlus 0.1 (AWGFactions Revamp)
« Reply #44 on: March 05, 2014, 08:54:58 pm »
Heyyyyy! Just remembered while was reading JC2 wiki.

What's about child-factions? You know, there are some factions like Panau Military Forces, Panau Secret Service, etc.
So, I've decided to make it similar, here goes the relationship table (made this as an example):

Quote
|--Panau Military Forces
  |---Secret Service
     |----Internal Intellignece Agency
  |---Military Police
  |---National Guard
  |---Anti-Gang Task Forces
     |---Anti-Gang Mercenary Forces
|--Panau Police Departament
  |---Drug Enforcement Administration
  |---Special Task Forces (something like SWAT or GSG9 or Berkut)
|--Drug Dealers
  |---Meth cookers (why not? :D)
  |---LSD makers
  |---Delivery mercenaries
     |----Delivery security
So, there is something like it.
Three base factions, that have their subfactions. As people join secondary (|---), they have both tags: parent and child:

Quote
[Panau Military Forces]
[Secret Service]

Probably not the best idea, but this may become handy if there is a kind of roleplay server. I know, there are also faction relationships, but this may be used in Police -|- Drug Dealers and DD's/Police's child factions.

Parent and child factions must be unable to become anyhow relationshiped. Instead of "Ally" or "Enemy" there will be displayed whatever variable will be set to parent faction (let's just think it will be "Co-Worker" for now).

A lot of work, but it is worth it. Besides, variant of this system was previously released in DarkRP as I remember.

Whad do you think?

EDIT:

What about respawns at faction base? Clientsided settings of this would be nice because base might be far away from current AOO so default respawn may be better for players.
« Last Edit: March 05, 2014, 09:25:16 pm by Esamir »