Raised This Month: $32 Target: $400
 8% 

Solved code Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ho83
Senior Member
Join Date: Aug 2020
Location: iran
Old 01-05-2021 , 10:29   code Problem
Reply With Quote #1

Hi. i have This Code. But The problem is that when you select a player, the code does not work on it. The code actually works on the person who opened the menu. Help me.
Thanks And Sorry For my Bad English.

PHP Code:
#include <amxmodx>
#include <colorchat>
#include <cstrike>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <fun>

#define PLUGIN "cc"
#define VERSION "1.0"
#define AUTHOR "mmd"

new szName[33], szPlayerName[33]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_clcmd("say /cc""cc");    
}


public 
cc(id)
{    
    if(!(
get_user_flags(id) & ADMIN_IMMUNITY))
    {
        
ColorChat(idRED"You Dont Have Access");
        
        return 
PLUGIN_HANDLED;
    }        
    new 
menu menu_create("\yMake""cc2_handler");

    
menu_additem(menu"\wBrow""1"0);        

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);

    
menu_display(idmenu0);

    return 
PLUGIN_HANDLED;
}

public 
cc2_handler(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
    new 
key str_to_num(data);

    switch(
key)
    {
         case 
1:
         {
            
brow(id);        
         }            
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}

public 
brow(id)
{
    new 
menu menu_create ("Players""brow_handler")
    
    new 
numplayers[32], tempidszTempID [10], tempname [32]
    
get_players (playersnum"a")
    
    for (new 
0numi++)
    {
    
tempid players ]
        
    
get_user_name (tempidtempname31)
    
num_to_str (tempidszTempID9)
    
menu_additem (menutempnameszTempID0)
    }
    
    
menu_display (idmenu)
    return 
PLUGIN_HANDLED
}

public 
brow_handler(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], name[64]
    new 
accesscallbackUserID
    
    menu_item_getinfo 
(menuitemaccessdata5name63callback)
    new 
tempid str_to_num(data)
    
    
get_user_name(idszName32)
    
get_user_name(tempidszPlayerName32)
    
UserID get_user_userid(tempid)
    return 
PLUGIN_CONTINUE


Last edited by ho83; 01-06-2021 at 04:24.
ho83 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-05-2021 , 23:29   Re: code Problem
Reply With Quote #2

There are two problems here.
  1. You are always executing the action code twice if the person executing the command is an admin and executing once regardless.
  2. You are using "id" for the action code but should be using "tempid".

However, since there is only one function in the entire plugin, it's all the same as just checking both the immunity and kick flags in the cc() function and then deleting lines 104 through 110. And of course fixing the "id" in the set_user_info() and entity_set_int() functions.
__________________

Last edited by fysiks; 01-05-2021 at 23:29.
fysiks is offline
ho83
Senior Member
Join Date: Aug 2020
Location: iran
Old 01-06-2021 , 04:23   Re: code Problem
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
There are two problems here.
  1. You are always executing the action code twice if the person executing the command is an admin and executing once regardless.
  2. You are using "id" for the action code but should be using "tempid".

However, since there is only one function in the entire plugin, it's all the same as just checking both the immunity and kick flags in the cc() function and then deleting lines 104 through 110. And of course fixing the "id" in the set_user_info() and entity_set_int() functions.
Thank you, dear. You always help me. Good luck
ho83 is offline
Reply


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 18:59.


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