Код:
#include <a_samp>
new admin_dialogid, ban_dialogid, kick_dialogid, tele_interior;
new Float:tele_x, Float:tele_y, Float:tele_z;
new boxstring[256], liststring[128], dialog_string[128];
new dialog_aName[MAX_PLAYER_NAME], dialog_pName[MAX_PLAYER_NAME], clicked[MAX_PLAYERS];
public OnFilterScriptInit()
{
print(" [FS] basic click admin by Famas");
liststring = "\tGoto\n\tBring\n\tKick\n\tKick (enter reason)\n\tBan\n\tBan (enter reason)";
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
if(IsPlayerAdmin(playerid))
{
ShowPlayerDialog(playerid, admin_dialogid, 2, "Admin Menu", liststring, "Select", "Cancel");
clicked[playerid] = clickedplayerid;
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
// =====================[ admin menu 1 - dialog box 0 ]=========================
if(dialogid == admin_dialogid)
{
if(IsPlayerAdmin(playerid))
{
if( !response ) return SendClientMessage(playerid, 0xFF6347AA, "You selected cancel!");
else
{
GetPlayerName(playerid, dialog_aName, sizeof(dialog_aName));
GetPlayerName(clicked[playerid], dialog_pName, sizeof(dialog_pName));
if(listitem == 0)
{
tele_interior = GetPlayerInterior(clicked[playerid]);
GetPlayerPos(clicked[playerid], tele_x, tele_y, tele_z);
SetPlayerPos(playerid, tele_x+0.5, tele_y, tele_z);
SetPlayerInterior(playerid, tele_interior);
format(dialog_string, sizeof(dialog_string),"You teleported to %s ", dialog_pName);
SendClientMessage(playerid, 0xFF6347AA, dialog_string);
return 1;
}
else if(listitem == 1)
{
tele_interior = GetPlayerInterior(playerid);
GetPlayerPos(playerid, tele_x, tele_y, tele_z);
SetPlayerPos(clicked[playerid], tele_x+0.5, tele_y, tele_z);
SetPlayerInterior(clicked[playerid], tele_interior);
format(dialog_string, sizeof(dialog_string),"You teleported %s ", dialog_pName);
SendClientMessage(playerid, 0xFF6347AA, dialog_string);
return 1;
}
else if(listitem == 2)
{
format(dialog_string, sizeof(dialog_string),"%s has been kicked by admin %s ", dialog_pName, dialog_aName);
SendClientMessageToAll(0xFF6347AA, dialog_string);
Kick(clicked[playerid]);
return 1;
}
else if(listitem == 3)
{
format(boxstring, sizeof(boxstring), "Player to Kick:\t%s\nReason:\n", dialog_pName);
ShowPlayerDialog(playerid, kick_dialogid, 1, "Kick Reason", boxstring, "Kick", "Cancel");
return 1;
}
else if(listitem == 4)
{
if( IsPlayerAdmin( clicked[playerid] ) )
return SendClientMessage(playerid, 0xFF6347AA, "You cannot ban RCON admin!");
format(dialog_string, sizeof(dialog_string), "%s has been banned by admin %s ", dialog_pName, dialog_aName );
SendClientMessageToAll(0xFF6347AA, dialog_string);
Ban(clicked[playerid]);
return 1;
}
else if(listitem == 5)
{
format(boxstring, sizeof(boxstring), "Player to ban:\t%s\nReason:\n", dialog_pName);
ShowPlayerDialog(playerid, ban_dialogid, 1, "Ban Reason", boxstring, "Ban", "Cancel");
return 1;
}
}
}
return 1;
}
// =====================[ ban reason - dialog box 1 ]=========================
if(dialogid == ban_dialogid)
{
if(IsPlayerAdmin(playerid))
{
if( !response ) return SendClientMessage(playerid, 0xFF6347AA, "You selected cancel!");
else
{
GetPlayerName(playerid, dialog_aName, sizeof(dialog_aName));
GetPlayerName(clicked[playerid], dialog_pName, sizeof(dialog_pName));
if( IsPlayerAdmin( clicked[playerid] ) )
return SendClientMessage(playerid, 0xFF6347AA, "You cannot ban RCON admin!");
format(dialog_string, sizeof(dialog_string), "%s has been banned! (%s:%s)", dialog_pName, dialog_aName, inputtext);
SendClientMessageToAll(0xFF6347AA, dialog_string);
BanEx(clicked[playerid],inputtext);
return 1;
}
}
return 1;
}
// =====================[ kick reason - dialog box 2 ]=========================
if(dialogid == kick_dialogid)
{
if(IsPlayerAdmin(playerid))
{
if( !response ) return SendClientMessage(playerid, 0xFF6347AA, "You selected cancel!");
else
{
GetPlayerName(playerid, dialog_aName, sizeof(dialog_aName));
GetPlayerName(clicked[playerid], dialog_pName, sizeof(dialog_pName));
if( IsPlayerAdmin( clicked[playerid] ) )
return SendClientMessage(playerid, 0xFF6347AA, "You cannot kick RCON admin!");
format(dialog_string, sizeof(dialog_string), "%s has been kicked! (%s:%s)", dialog_pName, dialog_aName, inputtext);
SendClientMessageToAll(0xFF6347AA, dialog_string);
Kick(clicked[playerid]);
return 1;
}
}
return 1;
}
return 0;
}