//    ---- Discord Defines ----
#define SendDiscordMessage DCC_SendChannelMessage
new DCC_Channel:g_PhazerUpdates;
new DCC_Channel:g_GangUpdates;
new DCC_Channel:g_PlayerLogUpdates;
new DCC_Channel:g_SQLUpdates;
new DCC_Channel:g_AmirOVH;
//----------------------------------------

/*
DCMD:players(user, channel, params[])
{
    new count = 0;
	new name[24];
	SendDiscordMessage(channel, "**__Online Players:__**");
	for(new i=0; i < MAX_PLAYERS; i++) {
	if(!IsPlayerConnected(i)) continue;
	GetPlayerName(i, name, MAX_PLAYER_NAME);
	{
        new string[250];
        format(string, sizeof(string), "```%s(%d)```", name, i);
	    SendDiscordMessage(channel, string);
	    count++; }
	}
	if (count == 0) return SendDiscordMessage(channel, "There are no players online.");
	return 1;
}
*/ 
DCMD:players(user, channel, params[])
{
    new players_string[14 + (2 * MAX_PLAYERS) + (MAX_PLAYER_NAME * MAX_PLAYERS) + 1] = "Online players:";
    for(new playerid, a = GetPlayerPoolSize(); playerid < a; playerid++)
	{
		if(IsPlayerConnected(playerid))
		{
		format(players_string, sizeof(players_string), "%s %s,", players_string, GetPlayerRPName(playerid));
		}
	}
	strdel(players_string, strlen(players_string), strlen(players_string));  // Delete trailing comma
    SendDiscordMessage(channel, players_string);
	return 1;
}

DCMD:help(user, channel, params[]) {

    SendDiscordMessage(channel, "```\n\n.help\n.ip\n.forums\n\n[Phazer Roleplay]```");
    return 1;
}

DCMD:ip(user, channel, params[]) {

    SendDiscordMessage(channel, "185.103.243.42:7777");
    return 1;
}

DCMD:forum(user, channel, params[]) {

    SendDiscordMessage(channel, "forum.kings-rp.com");
    return 1;
}

DCMD:c(user, channel, params[])
{
    new username[33], stringd[180], escaped[180], partext[180];
    DCC_GetUserName(user, username, sizeof(username));

 	if(isnull(params))
 	{
     	return SendDiscordMessage(channel, "``.c [message]``");
	}

	format(partext, sizeof(partext), "%s", params);
    DCC_EscapeMarkdown(partext, escaped, sizeof(escaped));

    format(stringd, sizeof(stringd), "**%s**: %s", username, partext);
    SendDiscordMessage(channel, stringd);

    foreach(new i : Player)
	{
	  	if(!PlayerInfo[i][pToggleOVH])
	  	{
	       	SendClientMessageEx(i, COLOR_OVH, "[OVH] %s (discord){FFFFFF}: %s", username, partext);
	  	}
 	}
    return 1;
}

/*
forward script_DCC_OnMessageCreate(DCC_Message:message, DCC_User:user);
public script_DCC_OnMessageCreate(DCC_Message:message, DCC_User:user)
{
	new bool:IsBot;
    if(g_AmirOVH && !IsBot)
	{
		new username[33], stringd[180], escaped[180], partext[180];
		DCC_GetUserName(user, username, sizeof(username));

		format(partext, sizeof(partext), "%s", message);
		DCC_EscapeMarkdown(partext, escaped, sizeof(escaped));

		format(stringd, sizeof(stringd), "**%s**: %s", username, partext);
		SendDiscordMessage(g_AmirOVH, stringd);

		foreach(new i : Player)
		{
			if(!PlayerInfo[i][pToggleOVH])
			{
				SendClientMessageEx(i, COLOR_OVH, "[OVH] %s (discord){FFFFFF}: %s", username, partext);
			}
		}
	}

	return 1;
}*/


/*
DCMD:stats(user, channel, params[]){

	new playername[MAX_PLAYER_NAME];
	if(sscanf(params,"s[24]",playername)){
		return SendDiscordMessage(channel, "``.stats [username]``");
 
	}

	new thread[120];
    mysql_format(connectionID, thread, sizeof(thread), "SELECT * FROM users WHERE uid = '%e' LIMIT 1", playername);
    mysql_tquery(connectionID, thread, "OnLoadStats", "s", playername);
	return 1;
}

forward OnLoadStats(channel, const playername[]);
public OnLoadStats(channel, const playername[])
{
	new string[320],level, phone, hours, skin; 
    if(!cache_num_rows()){
		DCC_SendChannelMessage(channel, "``This player does not exist``");
        return 1;
    }

    cache_get_value_name(0, "level", level);
    cache_get_value_name(0, "phone",  phone);
	cache_get_value_name(0, "hours", hours);
    cache_get_value_name(0, "skin", skin);
    cache_get_value_name_int(0, "gender",  gender);

	format(string, sizeof(string), "```%s - Level: %i - Hours played: %i - Skin ID: %i - Phone number: %i```", playername, level, hours, skin, phone);
	DCC_SendChannelMessage(channel, string);
	return 1;
}
*/