Raised This Month: $ Target: $400
 0% 

How can i get steamid of this menu?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Number1
Junior Member
Join Date: Jul 2018
Old 07-25-2018 , 13:54   Re: How can i get steamid of this menu?
Reply With Quote #1

Ok so i tried from 0 and now works but not everytime. Then i first join in the server and then another player connect to server everyting works fine, but if i joined second and try to ban some player i get banned by myself. Any suggestion? Code:

HTML Code:
#include <amxmodx>
#include <amxmisc>
new reason[32]
new bantime[32]
new target[33];

public plugin_init()
{
register_plugin("Banmenu", "SomeBody", "1.0");
register_clcmd("amx_newbanmenu", "cmdBanMenu")
}

public cmdBanMenu(id) {
if(!(get_user_flags(id) & ADMIN_BAN)) {
return PLUGIN_HANDLED
}
//Create a variable to hold the menu
new menu = menu_create( "Choose player to BAN", "menu_handler3" );

//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],szUserId[32];

//Fill players with available players
get_players( players, pnum);

//Start looping through all players
for ( --pnum; pnum>=0; pnum-- )
{
//Save a tempid so we do not re-index
tempid = players[pnum];

//Get the players name and userid as strings
get_user_name( tempid, szName, charsmax( szName ) );
formatex(szUserId, charsmax(szUserId), "%d", get_user_userid(tempid))

//Add the item for this player
menu_additem( menu, szName,szUserId, 0 );
}

//We now have all players in the menu, lets display the menu
menu_display( id, menu);

return PLUGIN_HANDLED
}

public menu_handler3( id, menu, item )
{
if ( item == MENU_EXIT )
{
return PLUGIN_HANDLED;
}
new szData3[6], szName[64];
new item,access, item_callback;
menu_item_getinfo( menu, item,access, szData3,charsmax(szData3), szName,charsmax( szName ), item_callback );

target[id] = find_player("k", str_to_num(szData3))
menu_destroy( menu );
AwesomeMenu( id )

return PLUGIN_HANDLED;
}

public AwesomeMenu( id ) {
new menu = menu_create( "Choose player BAN REASON", "menu_handler" );
menu_additem( menu, "Cheating", "", 0 );
menu_additem( menu, "Camping", "", 0 );;
menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
menu_display( id, menu, 0 );
}

public menu_handler( id, menu, item )
{
if ( item == MENU_EXIT )
{
menu_destroy( menu );
return PLUGIN_HANDLED;
}

new szData[6], szName[64];
new item_access, item_callback;
menu_item_getinfo( menu, item, item_access, szData,charsmax( szData ), szName,charsmax( szName ), item_callback );

switch( item )
{
case 0:
{
format(reason,charsmax(reason),"Cheating")
format(bantime,charsmax(bantime),"4320")
}
case 1:
{
format(reason,charsmax(reason),"Camping")
format(bantime,charsmax(bantime),"518400")
}
}

menu_destroy( menu );
Punish(id)
return PLUGIN_HANDLED;
}

public Punish(id) {
//kick

if (is_user_connected( target[id] ) )
{
new name[32]
get_user_name(id,name,31)
new name2[32]
get_user_name(target[id],name2,31)
client_cmd(id, "amx_ban ^"%s^" ^"%s^" ^"%s^"", name2,bantime,reason)
}
return PLUGIN_HANDLED;
}
Number1 is offline
jonatat
Senior Member
Join Date: Dec 2017
Old 07-25-2018 , 14:56   Re: How can i get steamid of this menu?
Reply With Quote #2

Check if userid is corret
jonatat is offline
Reply



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 12:47.


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