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

Solved Targeting people in bulk


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Leakbang
New Member
Join Date: Aug 2018
Old 03-17-2019 , 14:52   Targeting people in bulk
Reply With Quote #1

Hi all, so I made this plugin that strips people's weapons and it works fine if I target 1 person but if I want to target in bulk like for example @all or @!me it replies with [SM] Targets not found. I tried to mimic the same method used in kick.sp but I cannot make it work. I'm new to sourcepawn so any help is appreciated.
This is the code when I tried to mimic what was done in kick.sp
PHP Code:
RegAdminCmd("sm_raw"WeaponsRedADMFLAG_KICK"sm_raw <#userid|name>");
public 
Action WeaponsRed(int clientint args)
{
    if (
args 1)
    {
        
ReplyToCommand(client"[SM] Usage: sm_raw <#userid|name>");
        return 
Plugin_Handled;
    }
    
char arg1[32];
    
char arg[65];
    
char target_name[MAX_TARGET_LENGTH];
    
int target_list[MAXPLAYERS], target_count;
    
bool tn_is_ml;
    
    
GetCmdArg(1arg1sizeof(arg1));
    
int target FindTarget(clientarg1);
    if (
target == -1)
    {
        return 
Plugin_Handled;
    }
    
     if ((
target_count ProcessTargetString(
            
arg,
            
client
            
target_list
            
MAXPLAYERS
            
COMMAND_FILTER_CONNECTED,
            
target_name,
            
sizeof(target_name),
            
tn_is_ml)) > 0)
            {
                if (
tn_is_ml)
                {
                    
StripWeapons(target_count);
                    if(
red_hooked)
                    {
                        
Red_UnhookEvents();
                    }
                    else
                    {
                        
Red_HookEvents();
                    }
                    return 
Plugin_Handled;
                }
            }
    
StripWeapons(target);
    if(
red_hooked)
    {
        
Red_UnhookEvents();
    }
    else
    {
        
Red_HookEvents();
    }
    return 
Plugin_Handled;

and this is the original code which is less messier
PHP Code:
RegAdminCmd("sm_raw"WeaponsRedADMFLAG_KICK"sm_raw <#userid|name>");
public 
Action WeaponsRed(int clientint args)
{
    if (
args 1)
    {
        
ReplyToCommand(client"[SM] Usage: sm_raw <#userid|name>");
        return 
Plugin_Handled;
    }
    
char arg1[32];
    
    
GetCmdArg(1arg1sizeof(arg1));
    
int target FindTarget(clientarg1);
    if (
target == -1)
    {
        return 
Plugin_Handled;
    }
    
StripWeapons(target);
    if(
red_hooked)
    {
        
Red_UnhookEvents();
    }
    else
    {
        
Red_HookEvents();
    }
    return 
Plugin_Handled;


Last edited by Leakbang; 03-17-2019 at 20:24. Reason: Solved issue
Leakbang is offline
Leakbang
New Member
Join Date: Aug 2018
Old 03-17-2019 , 20:24   Re: Targeting people in bulk
Reply With Quote #2

Nevermind, figured the correct way to do it.
Leakbang 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 10:30.


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