Raised This Month: $ Target: $400
 0% 

Ban Player from Menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Andriis
Member
Join Date: May 2019
Old 05-31-2019 , 13:03   Ban Player from Menu
Reply With Quote #1

I am trying to make a menu with fixed ban types.. like swearing, i made the menu with some samples but its not working.. Can someone help me with this?

Code:
public BPlayerMenu0(id){
	new menu = menu_create("\rthS\d | \yChoose a Player:", "BPlayerMenu_Handler0");
	
	new players[32], pnum, tempid;
	
	new szName[32], szUserId[32];
	
	get_players( players, pnum, "a");
	
	for (new i; i<pnum; i++){
	tempid = players[i];
	
	get_user_name(tempid, szName, charsmax(szName));
	formatex(szUserId, charsmax(szUserId), "%d", get_user_userid(tempid));
	
	menu_additem(menu, szName, szUserId, 0);
	}
	
	menu_display(id, menu, 0);
}
public BPlayerMenu_Handler0(id, menu, item){	
	if (item == MENU_EXIT){
	menu_destroy(menu);
	return PLUGIN_HANDLED;
	}
	new data[5];
	new szIP[40]; 
	new szData[6], szName[64], AdminName[64];
	new _access, item_callback;
	menu_item_getinfo(menu, item, _access, szData,charsmax(szData), szName,charsmax(szName), item_callback);
	
	new tempid = str_to_num(data)
	get_user_name(tempid, szName, charsmax(szName ));
	get_user_ip(tempid, szIP, charsmax(szIP), 1)
	get_user_ip(id, AdminName, charsmax(AdminName), 1)
	
	server_cmd("amx_ban ^"%s^" ^"30^" ^"Do not swear^"",szName)
	console_print(id, "Banned name: ^"%s^"", szName)
	console_print(id, "Banned IP: ^"%s^"", szIP)
	console_print(id, "Ban reason: Swearing")
	console_print(id, "Admin: ^"%s^"", AdminName)

	menu_destroy( menu );
	return PLUGIN_HANDLED;
}
And also.. I'm not sure if I correctly defined the admin who is banning the player :/

Last edited by Andriis; 05-31-2019 at 13:04.
Andriis is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode