/report command don't works
#1

Код:
dcmd_reportar(playerid, params[])
{
	new tmp1[MAX_STRING], tmp2[MAX_STRING], idx;
	tmp1 = strtok(params, idx);
	tmp2 = strtok(params, idx);
	if(!strlen(tmp1) || !strlen(tmp2)) return SendClientMessage(playerid, COLOR_RED, "Usa: /reportar [ID] [Razon]");
	if(IsValidPlayer(playerid))
	{
	  new str[MAX_STRING], str2[MAX_STRING];
	  format(str, sizeof(str), "Reporte de: %s (%d) a %s (%d) (Razon: %s)",PlayerName(playerid),playerid,PlayerName(strval(tmp1)),strval(tmp1),tmp2);
		format(str2, sizeof(str2), "Has enviado exitosamente el reporte a los admins de %s (%d) (Razon: %s).",PlayerName(strval(tmp1)),tmp2);
		SendAdminMessage(COLOR_GREEN, str);
		SendClientMessage(playerid, COLOR_ORANGE, str2);
		return 1;
	} else return SendClientMessage(playerid, COLOR_RED, "Jugador no encontrado.");
}

stock PlayerName(playerid)
{
	new nombre[MAX_PLAYER_NAME];
	GetPlayerName(playerid, nombre, sizeof(nombre));
	return nombre;
}

stock SendAdminMessage(color, const str[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	  if(IsPlayerConnected(i))
	  {
	    if(PlayerInfo[i][pAdminLevel] > 0)
	    {
	      SendClientMessage(i, color, str);
				return 1;
			}
		}
	}
	return 1;
}

stock IsValidPlayer(playerid)
{
	if(IsPlayerConnected(playerid)) return 1;
	return 0;
}
i need help, when i use the command, the server being crashed..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)