Code:
Dim PlayerAddresses As Integer() = {100, 200, 300, 400} 'Player 1 | Player 2 | Player 3 | Player 4
Dim FunctionOffsets As Integer() = {&H1, &H2, &H3, &H4, &H5} 'Primary Ammo | Secondary Ammo | Grenades Ammo | Health | Score (Offset value from Player Address)
Public Function AnalyzeCommand(ByVal Command As String) As Integer()
Dim PlayerIndex, OptionIndex As Integer
If Command.Contains("p1") Then PlayerIndex = 0
If Command.Contains("p2") Then PlayerIndex = 1
If Command.Contains("p3") Then PlayerIndex = 2
If Command.Contains("p4") Then PlayerIndex = 3
If Command.Contains("pAmmo") Then OptionIndex = 0
If Command.Contains("sAmmo") Then OptionIndex = 1
If Command.Contains("gAmmo") Then OptionIndex = 2
If Command.Contains("health") Then OptionIndex = 3
If Command.Contains("score") Then OptionIndex = 4
Return {PlayerAddresses(PlayerIndex) + FunctionOffsets(OptionIndex), Int32.Parse(Command.Remove(0, Command.LastIndexOf(" ")))}
End Function