Code: Select all
else if (GetStringLeft(sSaid, 7) == "/roll d" && StringToInt(GetSubString(sSaid, 7, GetStringLength(sSaid))) != 0)
{
//maybe add while loop to make sure all characters after '/roll d' are numbers
int iDiceParsed = StringToInt(GetSubString(sSaid, 7, GetStringLength(sSaid)));
string sDiceParsed = IntToString(iDiceParsed);
int iDiceRoll = Random(StringToInt(sDiceParsed))+1;
SetPCChatMessage(COLOR_GOLD+sName+" rolled a d"+sDiceParsed+". The result was: "+IntToString(iDiceRoll)+COLOR_END);
return;
}