Why to add one at the function:
Well if you edit a map - What you want to do is to change as few things as possible from the map triggers. You could just change the code that decreases 1 from the integer, although it might affect something else. So you gotta think about your final result, as in other maps, it may want the array (the number inside the []) to be player ID + 100 or even player ID + I*c+3 while I and c are integer variables, finding them can be a bitch.
The example for what you need is the player id + 1. So that is why you get the player ID and add a 1 to it, as far as you concern, its all okay. If the map wants to decrease that integer by 1, let it have it, its not up to your concern.
As for the s2s.
Ill try to explain it as easly as possible.
JJ's CP is a string based CP. Every trigger needs some kind of event to run. Weather its a unit that does something like killing, or for our case, a player is writing something.
You can see in function main
Code:
call TriggerRegisterPlayerChatEvent(SomeNameOfATrigger,Player(zzz),"-",false)
Without getting into deep detail. the trigger called SomeNameOfATrigger will run once Player(zzz) is writing something on chat containing "-".
What will this trigger do?
Code:
call TriggerAddAction(SomeNameOfATrigger,function SomeFunctionName)
When Player(zzz) is writing something containing "-", the function SomeFunctionName will run. In our case its the Commands function.
Now we get to your answer (this is all backround)
When the function is running, it starting to hold some small variables, one of the is a string called s2s, that is holding GetEventPlayerChatString(), or in other words. It holds the string you just wrote on chat. Like -gold.
So the line you write is
Code:
if SubString(s2s,0,3)=="-s2s" then
meaning the if the characters between 0,1,2,3 are "-s2s" than it will run whats inside that if statemant. Remember that s2s is what your wrote on chat. So if wrote "-gold 1000" than s2s will be set to "-gold 1000"
the result of SubString(s2s,0,3) will be "-gol".
Since "-gol" isn't "-s2s". The if statemant wont run at all. And just skips forward.
Hope it clears things up for ya.