Closed mblokker closed 8 years ago
I see now that Saber handles this!
How can I be sure that the 4th argument is an ID and not part of the cheat/reason message if the message starts with a number?
My suggestion would be to always send an ID with the [report] message. If no ID is known, use 255 or -1. It can be filtered out manually.
The gamemode takes care of the parsing and will either broadcast an IRC message with 4 or 5 variables, so Nuwani shouldn't have to worry about that. It can just count the number of parameters supplied and act on this.
That won't work if the reason contains multiple words.
I see now. We used to have this problem with [gang] as well if I remember correctly. Maybe we can use a similar fix for this?
That uses this syntax: [gang] playerId playerName gangId gangNameLength gangName message
It adds the length of the gang name right in front the gang name itself, because both gangName and message can contain spaces. That solution won't work in this case unfortunately, as a parameter in front of the message (the reason) is optional. In the [gang] message, all parameters are always there, making parsing a lot easier.
It looks like we've got two options here:
Both work for me, but I'm inclined to prefer option 1 because it avoids some duplication, and an id of 255 makes it clear enough that it's not real. Option 2 would be slightly cleaner from an aesthetic point of view, but that's not something we have to optimize for too much.
/cc @Xanland
For both of them is something to say to be honest.
I had option 2 in my thoughts, since something like that was also used somewhere a long time ago. Although option 1 is not bad either, although 255 could be a problem perhaps in the far future. 😜
Since /report has been rewritten into a javascript-variant, this issue seems invalid.
When users want to report players who are at that time not in-game, they can always use @msg so they can be more specific.
As of https://github.com/LVPlayground/playground/commit/98af5ce240bd7b2a230d8dce540396440f56c11f, a player name might be send with the [report] message. This means we can either have:
Suspected player: \3 (Id:\4) - Cheat/reason: \5
with format:%s %d %s %d %s
, orSuspected player: \3 - Cheat/reason: \4
with format:%s %d %s %s
(what we have now).Somehow Nuwani should know that when [report] is used with 5 parameters, the first format applies. For 4 parameters, the second format should be used.