Raised This Month: $ Target: $400
 0% 

Solved The "retry" command fails when targeting a specific player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hl2dmgamer
Junior Member
Join Date: Dec 2023
Old 12-22-2023 , 02:39   The "retry" command fails when targeting a specific player
Reply With Quote #1

The "retry" command fails when targeting a specific player. (done for all players and that is wrong)
Can someone help me edit?
Thank you guys
PHP Code:
#include <sourcemod>
#include <sdktools>
#define PLUGIN_VERSION "1"

public OnPluginStart() {
CreateConVar("sm_retrytest_version"PLUGIN_VERSION"retrytest Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY)
    
RegAdminCmd("sm_retrytest"CommandretryClientADMFLAG_SLAY"sm_retrytest <#userid|name>");
}

public 
Action:CommandretryClient(clientargs) {
    
ReplyToCommand(client"retry <#userid|name>");
    return 
Plugin_Handled


Last edited by hl2dmgamer; 12-29-2023 at 13:52.
hl2dmgamer is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 12-22-2023 , 07:52   Re: The "retry" command fails when targeting a specific player
Reply With Quote #2

https://sm.alliedmods.net/new-api/co...ReplyToCommand

This ReplyToCommand will reply to command user into chat output or console output, where user is executing command.

*edit
https://sm.alliedmods.net/new-api/sd...econnectClient
ReconnectClient

Then look other SM source plugin files, where it use targeting.
example https://forums.alliedmods.net/showpo...55&postcount=2
example 2 https://forums.alliedmods.net/showpo...80&postcount=4
__________________
Do not Private Message @me

Last edited by Bacardi; 12-22-2023 at 13:27.
Bacardi is offline
hl2dmgamer
Junior Member
Join Date: Dec 2023
Old 12-23-2023 , 03:21   Re: The "retry" command fails when targeting a specific player
Reply With Quote #3

Quote:
Originally Posted by Bacardi View Post
https://sm.alliedmods.net/new-api/co...ReplyToCommand

This ReplyToCommand will reply to command user into chat output or console output, where user is executing command.

*edit
https://sm.alliedmods.net/new-api/sd...econnectClient
ReconnectClient

Then look other SM source plugin files, where it use targeting.
example https://forums.alliedmods.net/showpo...55&postcount=2
example 2 https://forums.alliedmods.net/showpo...80&postcount=4
Sorry. I found it only works for admins.
does not work on other players.
How to target individual <#userid|name> ?

Thank you for your help
cheers

Last edited by hl2dmgamer; 12-23-2023 at 14:20.
hl2dmgamer is offline
hl2dmgamer
Junior Member
Join Date: Dec 2023
Old 12-23-2023 , 11:49   Re: The "retry" command fails when targeting a specific player
Reply With Quote #4

PHP Code:
#include <sourcemod>
#include <halflife>
#include <sdktools>
#include <sdktools_client>

public OnPluginStart() {
    
RegAdminCmd("admin_retry"Command_Retry0"Forces the player to RETRY connection.");
    }
public 
Action Command_Retry(int clientint args)
{
    if (
args 1)
    {
        
PrintToConsole(client"Usage: admin_retry <#userid|name>");
        return 
Plugin_Handled;
    }
 
    
char name[32];
    
int target = -1;
    
GetCmdArg(1namesizeof(name));
 
    for (
int i 1<= MaxClientsi++)
    {
        if (!
IsClientConnected(i))
        {
            continue;
        }
 
        
char other[32];
        
GetClientName(iothersizeof(other));
 
        if (
StrEqual(nameother))
        {
            
target i;
        }
    }
 
    if (
target == -1)
    {
        
PrintToConsole(client"Could not find any player with the name: \"%s\""name);
        return 
Plugin_Handled;
    }
 
    if (!
CanUserTarget(clienttarget))
    {
        
PrintToConsole(client"You cannot target this client.");
        return 
Plugin_Handled;
    }
 
    
ReconnectClient(target);
 
    return 
Plugin_Handled;

made a plugin - it works when "ReconnectClient" slow shows a black loading screen ?, then you enter the game. OK game HL2dm
will go to fix it to fast loading?

Last edited by hl2dmgamer; 12-23-2023 at 12:05.
hl2dmgamer is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 12-24-2023 , 03:40   Re: The "retry" command fails when targeting a specific player
Reply With Quote #5

I show my example, using FindTarget (because you want target one person oly).

PHP Code:
#include <sdktools>

public void OnPluginStart()
{
    
// Admin command. Can be override later by using admin_overrides configure
    
RegAdminCmd("admin_retry"admin_retryADMFLAG_CHANGEMAP"Reconnect player");

    
LoadTranslations("common.phrases"); // You need load translation files when use ProcessTargetString and ReplyToTargetError()
}

public 
Action admin_retry(int clientint args)
{
    
// When using command without arguments, print command tip
    
if(args 1)
    {
        
ReplyToCommand(client"[SM] Command usage: admin_retry @me, admin_retry #userid, admin_retry \"#STEAM_0:1:123\", admin_retry name");

        return 
Plugin_Handled;
    }

    
// Get command first argument
    
char pattern[MAX_NAME_LENGTH];
    
GetCmdArg(1patternsizeof(pattern));

    
// nobots, check immunity
    
int target FindTarget(clientpatterntruetrue);

    if(
target == -1)
    {
        
// FindTarget error, and it will show targeting error in chat or console. (Using translation "common.phrases").
        
return Plugin_Handled;
    }

    
ShowActivity2(client"[SM] ""Reconnect player %N"target);

    
//ReconnectClient(target);
    
ClientCommand(target"retry");

    return 
Plugin_Handled;

I don't know HL2DM game reconnect, how it should work... I have not tested.
:/



*edit
Try ClientCommand "retry". I updated in my code
__________________
Do not Private Message @me

Last edited by Bacardi; 12-24-2023 at 04:00.
Bacardi is offline
hl2dmgamer
Junior Member
Join Date: Dec 2023
Old 12-24-2023 , 09:47   Re: The "retry" command fails when targeting a specific player
Reply With Quote #6

Thank you sir for the code
WOW dear sir you are the best.
It works like a charm, "fast-reconnect".
I would guess so all sourcemod games will probably work.
Boots are immune "Find Target(client, pattern, true, true);"
Perfectly

Last edited by hl2dmgamer; 12-24-2023 at 09:52.
hl2dmgamer is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 12-24-2023 , 12:27   Re: The "retry" command fails when targeting a specific player
Reply With Quote #7

Your welcome
__________________
Do not Private Message @me
Bacardi 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 03:57.


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