2019-04-14, 07:21 PM
(2019-04-14, 12:46 PM)James Wrote: Perfect, you can test the comun code for this plugin. This code send message of your channel when a user login.
Code:new DCC_Channel:g_WelcomeChannelId;
public OnGameModeInit()
{
? ?DCC_Connect("El token de tu BOT que has a?adido a tu server.cfg ahora aqu?");
? ?return 1;
}
public OnPlayerSpawn(playerid)
{
? ?new name[MAX_PLAYER_NAME 1];
? ?GetPlayerName(playerid, name, sizeof name);
? ?
? ?if (_:g_WelcomeChannelId == 0)
? ? ? ?g_WelcomeChannelId = DCC_FindChannelById("PON LA ID"); // Introduce aqu? el ID del canal donde quieras que aparezca el mensaje. Tendr?s que tener el modo developer activado de Discord.
? ?
? ?new str[128];
? ?format(str, sizeof str, "El jugador %s ha entrado a Nombre de tu servidor.", name); // El %s se reemplazar? por el nick que tenga el jugador.
? ?DCC_SendChannelMessage(g_WelcomeChannelId, msg);
? ?return 1;
}
public DCC_OnChannelMessage(DCC_Channel:channel, const author[], const message[])
{
? ?new channel_name[32];
? ?DCC_GetChannelName(channel, channel_name);
? ?new str[145];
? ?format(str, sizeof str, "[Discord/%s] %s: %s", channel_name, author, message);
? ?SendClientMessageToAll(-1, str);
? ?return 1;
} ?
Edit: I translate this message for respect the Burgershot's rules.
I don't know which version you use of the Discord plugin, but DCC_Connect doesn't exists.
I have it kinda like this in my server, maybe you can use it:?https://pastebin.com/hwsWbRr4