|
Veteran Member
Join Date: Dec 2009
Location: Looking for you!
|

10-07-2011
, 04:22
Re: Help adding menu
|
#8
|
Can someone please help me? I've read tutorials on how to make a menu, but i can't figure out how to attach a menu and a plugin. When I activate the menu, it doesn't react when I choose a player.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#define PLUGIN "Ban with proof"
#define VERSION "1.0.4"
#define AUTHOR "[lego]F34R"
static const banurl[] = "frz_666"
new Bantype
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_banshot","banwithproof",ADMIN_BAN,"<Ban username with screenshot 1=IP 2=Steamid 3=Amxbans 4=Not ban")
register_cvar("amx_banurl",banurl)
Bantype = register_cvar("amx_banshot_type", "2")
register_clcmd( "my_player_menu","AwesomeMenu")
}
public AwesomeMenu(id)
{
//Create a variable to hold the menu
new menu = menu_create("\rLook at this Player Menu!:", "menu_handler");
//We will need to create some variables so we can loop through all the players
new players[32], pnum, tempid;
//Some variables to hold information about the players
new szName[32], szTempid[10];
//Fill players with available players
get_players(players, pnum);
//Start looping through all players
for( new i; i<pnum; i++ )
{
//Save a tempid so we do not re-index
tempid = players[i];
//Get the players name and id as strings
get_user_name(tempid, szName, charsmax(szName));
num_to_str(tempid, szTempid, charsmax(szTempid));
//Add the item for this player
menu_additem(amx_banshot, szName, szTempid, 0);
}
//We now have all players in the menu, lets display the menu
menu_display(id, amx_banshot, 0);
}
public menu_handler(id, amx_banshot, item)
{
if( item == MENU_EXIT )
{
menu_destroy(amx_banshot);
return PLUGIN_HANDLED;
}
new data[6], szName[64];
new access, callback;
menu_item_getinfo(amx_banshot, item, access, data,charsmax(data), szName,charsmax(szName), callback);
//Get the id of the player that was selected
new tempid = str_to_num(data);
//If the player is alive
if( is_user_alive(tempid) )
{
//Set their health to 100
set_user_health(tempid, 100);
}
menu_destroy(amx_banshot);
return PLUGIN_HANDLED;
}
public banwithproof(id,level,cid){
if(!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED;
new authid[32], ipadd[32], name[32],CurrentTime[9], hostname[64] ,banurl[64]
new arg[32], arg2[32], temp[2]
read_argv(1,arg,31)
read_argv(2,arg2,31)
new target = cmd_target(id,arg,1)
if (!target) return PLUGIN_HANDLED
get_user_ip(target,ipadd,31)
get_cvar_string("hostname",hostname,63)
get_user_name(target,name,31)
get_user_authid(target,authid,31)
get_cvar_string("amx_banurl", banurl,63)
log_to_file("BannedwithSS.txt"," %s | IP: %s^n",name,ipadd)
client_print(target,print_chat, "[Banned] %s",hostname)
client_print(target,print_chat, "[Banned] %s @ IP - %s",name,ipadd)
get_time("%m/%d/%Y - %H:%M:%S",CurrentTime,31)
client_print(target,print_chat, "[Banned] %s",CurrentTime)
client_print(target,print_chat, "[Banned] Skype: %s",banurl)
console_print(target,"[Banned] %s",hostname)
console_print(target,"[Banned] %s @ IP - %s",name,ipadd)
console_print(target,"[Banned] %s",CurrentTime)
console_print(target,"[Banned] Skype: %s",banurl)
client_cmd(target,"wait;wait;snapshot;wait;wait;snapshot;wait;wait;snapshot;wait;wait;snapshot;wait;wait;snapshot")
temp[0] = target
temp[1] = str_to_num(arg2)
set_task(5.0,"persontoban", target, temp, 2)
return PLUGIN_HANDLED
}
public persontoban(arg[]){
new name2[32]
new target = arg[0]
new bantime = arg[1]
get_user_name(target,name2,31)
switch (get_pcvar_num(Bantype))
{
case 1:
{
server_cmd("amx_ban %s %d",name2,bantime)
}
case 2:
{
server_cmd("amx_banip %s %d",name2,bantime)
}
case 3:
{
server_cmd("amx_ban %d %s",bantime,name2)
}
case 4:
{
server_cmd("amx_say Skype: %s",banurl)
}
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
+ can someone help me add a ban reason for banning by IP if possible. Because when i ban by IP it says: banned by %hostname% and I need there to be my skype so banned player could contact me.
__________________
Last edited by dj_freeze; 10-07-2011 at 05:11.
|
|