I like that you want to turn 1 command into 2.
Step 1: Variable setup
To do this, you need 2 variables: playerColor (string array) and factionName (string array).
In the trigger with as event "Map Initialization", set up the variables like this:
-
Set playerColor[1] = red
-
Set playerColor[2] = blue
-
-------- ... --------
-
Set factionName[1] = rome
-
Set factionName[2] = paris
-
-------- ... --------
Note that all of them are lower-case only, this is for later on, when we register what the players are saying.
I think the rest of that trigger should be clear.
Step 2: The command
The event is quite self-explanatory: Player (X) types -give as a substring.
"As a substring" means it can be anything that includes the text "-give".
-
Events
-

Player - Player 1 (Red) types a chat message containing -give as A substring
-

Player - Player 2 (Blue) types a chat message containing -give as A substring
-

Player - Player 3 (Teal) types a chat message containing -give as A substring
-

-------- ... --------
Now we need to know what it is that he wrote, we will use this action for that:
-
Set tempString = (String((Substring((Entered chat string), 7, (Length of (Entered chat string))))) as Lower case)
tempString is a new variable (string, no array).
Set tempString = "Convert - Convert String Case" -> "Substring".
As you can see, we make the entire text behind "-give" lower-case. This is because string comparisons are case-sensitive and we want the players to be able to write anything and not be bound to lower-case only.
(The length is from 7 to the end, because "-give" is 5 letters, behind that comes a space and then the 7th letter is the first letter of the word we're trying to look for).
We're also going to add this action (new variable: tempGroup, unit group no array):
-
Set tempGroup = (Units currently selected by (Triggering player))
That way we already know which units we want to change ownership of (if a valid command is given).
Now we're going to loop through the other strings (playerColor and factionName) to see if we can get a match:
-
For each (Integer A) from 1 to 8, do (Actions)
-

Loop - Actions
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




tempString Equal to playerColor[(Integer A)]
-



Then - Actions
-




Unit Group - Pick every unit in tempGroup and do (Actions)
-





Loop - Actions
-






Unit - Change ownership of (Picked unit) to (Player((Integer A))) and Change color
-



Else - Actions
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




(Integer A) Less than or equal to 5
-




tempString Equal to factionName[(Integer A)]
-



Then - Actions
-



Else - Actions
Change the "from 1 to 8" for whatever there's most of (factions or players).
E.g.: if there's 8 players and 5 factions, then do as I did: loop from 1 to 8. If there are 8 players and 10 factions, then loop from 1 to 10.
Also, I don't know who the factions belong to, so I didn't really put any actions for those :S
At the end of the trigger, we want to remove the unit group:
-
Custom script: call DestroyGroup( udg_tempGroup )
I believe that should work.
Edit: Hah, I was taking a bit too long writing this I think
