open.mp forum
[Plugin] [HELP] Discord connector. - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Plugin] [HELP] Discord connector. (/showthread.php?tid=142)



[HELP] Discord connector. - Mugsy - 2019-04-14

I need help in this area, do not do anything about this and I need to do it urgently, I would like it if you could help me.



https://github.com/maddinat0r/samp-discord-connector


RE: [HELP] Discord connector. - SyS - 2019-04-14

What's the problem?


RE: [HELP] Discord connector. - Mugsy - 2019-04-14

(2019-04-14, 10:16 AM)SyS Wrote: What's the problem?



Google translator



I would need the basics to adapt it to my GM, because I do not understand anything. An example, when a user sends an advertisement in SAMP, which is also sent in discord, for example in the channel # announcements-samp. I do not know if you can understand me.


RE: [HELP] Discord connector. - James - 2019-04-14

Supongo que ser?s hispanohablante. El enlace de github que has proporcionado es el Source Code para desarrolladores, aqu? te dejo el enlace que te dar? opci?n a elegir el plugin para la versi?n del SO que est?s usando para tu servidor (Debian, Linux, Windows) https://github.com/maddinat0r/samp-discord-connector/releases.



Si tienes dudas col?calas y te ayudar?.


RE: [HELP] Discord connector. - Mugsy - 2019-04-14

(2019-04-14, 10:28 AM)James Wrote: Supongo que ser?s hispanohablante. El enlace de github que has proporcionado es el Source Code para desarrolladores, aqu? te dejo el enlace que te dar? opci?n a elegir el plugin para la versi?n del SO que est?s usando para tu servidor (Debian, Linux, Windows) https://github.com/maddinat0r/samp-discord-connector/releases.



Si tienes dudas col?calas y te ayudar?.



Muchas gracias.



Ya tengo descargada la versi?n de Windows, y acabo de colocar todos los archivos en la GM, hasta ahi llego, pero luego estoy super perdido, es mi primera vez haciendo esto, eso si tengo ya el bot creado y dentro de mi discord, pero esta OFFLINE, como procedo ahora.


RE: [HELP] Discord connector. - James - 2019-04-14

Add this plugin?

Code:
plugins?discord-connector



Add this line on your server.cfg

Code:
discord_bot_token TOKEN BOT



Add the include on your gamemode

Code:
#include <discord-connector>



RE: [HELP] Discord connector. - Mugsy - 2019-04-14

(2019-04-14, 10:41 AM)James Wrote: Despu?s de a?adir a tu proyecto los archivos tendr?s que a?adir lo siguiente a tu server.cfg:

Code:
plugins?discord-connector (Tendr?s m?s de un plugin lo a?ades al final)



Creas abajo del todo de tu server.cfg una nueva l?nea con esto:

Code:
discord_bot_token INTRODUCE AQU? EL TOKEN DE TU BOT



Con pawnoscript abres tu proyecto .pwn y a?ades estos includes:

Code:
#include <discord-connector>



Cuando tengas todo esto implementado resp?ndeme y vamos con las funciones.



Listo, lo tengo, pero te aviso que mi BOT no tiene nada de codigo eh. Pasemos a lo siguiente :)


RE: [HELP] Discord connector. - James - 2019-04-14

Are compiled your gamemode?


RE: [HELP] Discord connector. - Mugsy - 2019-04-14

(2019-04-14, 11:22 AM)James Wrote: ?Has compilado tu gamemode con el include a?adido?



Si, no da error.


RE: [HELP] Discord connector. - TommyB - 2019-04-14

It's great that you're getting help but you're gonna have to keep the discussion in English in these sections.


RE: [HELP] Discord connector. - James - 2019-04-14

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.


RE: [HELP] Discord connector. - Mugsy - 2019-04-14

(2019-04-14, 12:43 PM)TommyB Wrote: It's great that you're getting help but you're gonna have to keep the discussion in English in these sections.

OK sorry.

(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 already did, I put that in the GM.
error: error 017: undefined symbol "DCC_Connect"
error: error 017: undefined symbol "msg"


RE: [HELP] Discord connector. - James - 2019-04-14

Change 'msg' for 'str2'.?With this change you're can't have error.


RE: [HELP] Discord connector. - BlackBank - 2019-04-14

(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


RE: [HELP] Discord connector. - Mugsy - 2019-04-14

tomorrow test


RE: [HELP] Discord connector. - Mugsy - 2019-04-15

closed pls, thanks all