All pastes #451229 Raw Edit

Something

public text v1 · immutable
·published 2007-04-21 10:16 UTC
rendered paste body
	if(strcmp(cmd, "/report", true) == 0)
	{
	    tmp = strtok(cmdtext, idx);
	    if(!strlen(tmp))
	    {
	        SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /report [playerid] [reason]");
	        return 1;
	    }
	    new reportid = strval(tmp);

	    if(strlen(cmdtext) < idx)
	    {
	        // this will check if the rest of the command (the reason why the player has been reported)
	        // is given, if not code in this if is executed. I'm not sure if that'll work, however it's worth
	        // a try
	        SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /report [playerid] [reason]");
	        return 1;
	    }

	    if (IsPlayerConnected(reportid))
	    {
	        new player_name[MAX_PLAYER_NAME], str[67];
	        GetPlayerName(reportid, player_name, MAX_PLAYER_NAME);

	        format(str, sizeof(str), "Report from %s: %s", player_name, cmdtext[idx]);
	        SendClientMessageToAdmins(COLOR_YELLOW, str);
	    } else {
	        SendClientMessage(playerid,COLOR_YELLOW, "This player is not online!");
	    }
	    return 1;
	}