26.12.2015, 00:45
Code:
#include <strlib>
Code:
public onPlayerCommandText(playerid, cmdtext[]) { if (!strcmp("/dice", cmdtext)) { new dicenumber = random(6) + 1; // this is the variable new strdicenumber[2] // the String valstr(strdicenumber, dicenumber); // this is the valstr function SendClientMessage(playerid, COLOR_GREEN, str_replace("DICENUMBER", strdicenumber, "You rolled #DICENUMBER); for(new player = 0; player < MAX_PLAYERS; player++){ SendClientMessage(player, COLOR_RED, str_replace("DICENUMBER", strdicenumber, "Someone rolled #DICENUMBER); } return 1; // The return statement is going to signal to the command was executed properly } return 0; // the return 0; is not going to be executed. }
Enjoy
