CMD:cbot(playerid, params[])
{
if(!IsPlayerLuxAdminLevel(playerid, 5) || !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, LIGHTBLUE, "Necesitas ser administrador para usar este Comando!");
ShowPlayerDialog(playerid, BotD, DIALOG_STYLE_LIST, "Chatbot Configs", "Habilitar/Deshabilitar\nBloquear Player\nDesbloquear Player\nEnviar mensaje", "Aceptar", "");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == BotD)
{
if(response)
{
if(listitem == 0)
{
SwitchBot();
}
else if(listitem == 1)
{
ShowPlayerDialog(playerid, BotD1, DIALOG_STYLE_INPUT, "Bloquear un Jugador", "", "Aceptar", "Cancelar");
}
else if(listitem == 2)
{
ShowPlayerDialog(playerid, botD2, DIALOG_STYLE_INPUT, "Desbloquear un Jugador", "", "Aceptar", "Cancelar");
}
else if(listitem == 3)
{
ShowPlayerDialog(playerid, BotD3, DIALOG_STYLE_INPUT, "Enviar un texto", "", "Aceptar", "Cancelar");
}
}
}
else if(dialogid == BotD1)
{
if(response)
{
new string[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(sscanf(inputtext, "d", bbid)) return ShowPlayerDialog(playerid, BotD1, DIALOG_STYLE_INPUT, "Desbloquear un Jugador", "", "Aceptar", "Cancelar");
else
{
if(BBot[bbid] == 0)
{
format(string, sizeof(string), "El jugador %s (%s) no esta bloqueado!", pname, bbid);
SendClientMessage(playerid, LIGHTBLUE, string);
}
else if(BBot[bbid] == 1)
{
BBot[bbid] = 1;
format(string, sizeof(string), "El jugador %s (%s) fue bloqueado!", pname, bbid);
SendClientMessage(playerid, LIGHTBLUE, string);
}
}
}
}
else if(dialogid == BotD2)
{
if(response)
{
new string[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(sscanf(inputtext, "d", bbid)) return ShowPlayerDialog(playerid, BotD2, DIALOG_STYLE_INPUT, "Desbloquear un Jugador", "", "Aceptar", "Cancelar");
else
{
format(string, sizeof(string), "El jugador %s (%s) fue desbloqueado!", pname, bbid);
SendClientMessage(playerid, LIGHTBLUE, string);
BBot[bbid] = 0;
}
}
}
else if(dialogid == BotD3)
{
if(response)
{
new string[128];
if(isnull(inputtext)) return ShowPlayerDialog(playerid, BotD3, DIALOG_STYLE_INPUT, "Enviar un texto", "", "Aceptar", "Cancelar");
else if(!isnull(inputtext))
{
format (string, sizeof(string), inputtext);
SendBotMessage(inputtext);
}
}
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid){
case BotD:
if(response){
switch(listitem){
case 0: SwitchBot();
case 1: ShowPlayerDialog(playerid, BotD1, DIALOG_STYLE_INPUT, "Bloquear un Jugador", "", "Aceptar", "Cancelar");
case 2: ShowPlayerDialog(playerid, botD2, DIALOG_STYLE_INPUT, "Desbloquear un Jugador", "", "Aceptar", "Cancelar");
case 3: ShowPlayerDialog(playerid, BotD3, DIALOG_STYLE_INPUT, "Enviar un texto", "", "Aceptar", "Cancelar");
}
}
case BotD1:
if(response){
new str[128], name[MAX_PLAYER_NAME];
if(sscanf(inputtext, "d", bbid))return ShowPlayerDialog(playerid, BotD1, DIALOG_STYLE_INPUT, "Desbloquear un Jugador", "", "Aceptar", "Cancelar");
if(!IsPlayerConnected(bbid))return SendClientMessage(playerid, RED, "ERROR: El jugador no se encuentra conectado");
GetPlayerName(bbid, name, MAX_PLAYER_NAME);
if(!BBot[bbid]){
BBot[bbid] = 1;
format(str, 128, "El jugador %s(%i) fue bloqueado!", name, bbid);
SendClientMessage(playerid, LIGHTBLUE, str);
}
else{
format(str, 128, "El jugador %s(%i) ya esta bloqueado!", name, bbid);
SendCLientMessage(playerid, RED, str);
}
}
case BotD2:
if(response){
new str[128], name[MAX_PLAYER_NAME];
if(sscanf(inputtext, "d", bbid)return ShowPlayerDialog(playerid, BotD2, DIALOG_STYLE_INPUT, "Desbloquear un Jugador", "", "Aceptar", "Cancelar"); if(!IsPlayerConnected(bbid))return SendClientMessage(playerid, RED, "ERROR: El jugador no se encuentra conectado");
if(!IsPlayerConnected(bbid))return SendClientMessage(playerid, RED, "ERROR: El jugador no se encuentra conectado");
GetPlayerName(bbid, name, MAX_PLAYER_NAME);
if(BBot[bbid]){
BBot[bbid] = 0;
format(str, 128, "El jugador $s(%i) fue desbloqueado!", name, bbid);
SendClientMessage(playerid, LIGHTBLUE, str);
}
else{
format(str, 128, "El jugador %s(%i) no esta bloqueado!", name, bbid);
SendClientMessage(playerid, LIGHTBLUE, str);
}
}
case BotD3:
if(response){
if(isnull(inputtext)) return ShowPlayerDialog(playerid, BotD3, DIALOG_STYLE_INPUT, "Enviar un texto", "", "Aceptar", "Cancelar");
SendBotMessage(inputtext);
}
}
return 1;
}
decime si te funciona
![]() |