Raised This Month: $51 Target: $400
 12% 

[ALL] Simple 'Move To Spec' plugin


Post New Thread Reply   
 
Thread Tools Display Modes
bebe9b
Veteran Member
Join Date: May 2009
Location: Romania
Old 05-22-2019 , 09:09   Re: [ALL] Simple 'Move To Spec' plugin
Reply With Quote #31

solved
__________________
respecta si vei fi respectat

Last edited by bebe9b; 05-22-2019 at 13:50.
bebe9b is offline
Et3rnity
Member
Join Date: Sep 2018
Location: Romania
Old 01-16-2020 , 13:40   Re: [ALL] Simple 'Move To Spec' plugin
Reply With Quote #32

Can you guys help me? How can i set after the player type !afk he will be moved after x seconds?

Code:
#pragma newdecls required 
#pragma semicolon 1

#include <sourcemod> 
#include <sdktools> 
#include <cstrike> 

public Plugin myinfo =  
{ 
    name = "Send player to spec", 
    author = "Arkarr", 
    description = "A simple spectator manager.", 
    version = "1.0", 
    url = "http://www.sourcemod.net" 
}; 

public void OnPluginStart() 
{ 
    RegConsoleCmd("sm_spec", Command_Spectator, "Send player to spec team."); 
    RegConsoleCmd("sm_afk", Command_Spectator, "Send player to spec team."); 
    RegAdminCmd("sm_fspec", ForceSendPlayerAFK, ADMFLAG_GENERIC, "sage: sm_fspec <#userid|name>"); 
     
    LoadTranslations("common.phrases"); 
} 

public Action Command_Spectator(int client, int args) 
{ 
    if (client) // commands can be executed by Console (client == 0) 
    { 
        if(GetClientCount() >= 12)
        {
            SendPlayerToSpectators(client);
        }
        else
        {
            PrintToChat(client, "[SM] You cannot use the command yet.");
        }
    } 
    return Plugin_Handled; 
} 

public Action ForceSendPlayerAFK(int client, int args) 
{ 
    if (args < 1) 
    { 
        ReplyToCommand(client, "[SM] Usage: sm_fspec <#userid|name>"); 
        return Plugin_Handled; 
    } 
     
    char arg[MAX_TARGET_LENGTH]; 
    GetCmdArg(1, arg, sizeof(arg)); 
     
    char target_name[MAX_TARGET_LENGTH]; 
    int target_list[MAXPLAYERS], target_count; 
    bool tn_is_ml; 
     
    if ((target_count = ProcessTargetString( 
            arg, 
            client,  
            target_list,  
            MAXPLAYERS,  
            COMMAND_FILTER_CONNECTED, 
            target_name, 
            sizeof(target_name), 
            tn_is_ml)) > 0) 
    { 
        for (int i = 0; i < target_count; i++) 
        { 
            SendPlayerToSpectators(target_list[i]); 
        } 
    } 
    else 
    { 
        ReplyToTargetError(client, target_count); 
    } 
     
    return Plugin_Handled; 
} 

void SendPlayerToSpectators(int client) 
{ 
    if (GetClientTeam(client) != CS_TEAM_SPECTATOR) 
    { 
        if (IsPlayerAlive(client)) 
        { 
            ForcePlayerSuicide(client); 
        } 
         
        ChangeClientTeam(client, CS_TEAM_SPECTATOR); 
    } 
}
Et3rnity is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 01-16-2020 , 14:17   Re: [ALL] Simple 'Move To Spec' plugin
Reply With Quote #33

Create a timer and put where is SendPlayerToSpectators(var), then inside the timer function you call the SendPlayerToSpectators(client) again. (Don't forget to pass ClientUserId instead ClientId inside the timer)
__________________

Last edited by Marttt; 01-16-2020 at 14:17.
Marttt is online now
Et3rnity
Member
Join Date: Sep 2018
Location: Romania
Old 01-17-2020 , 09:22   Re: [ALL] Simple 'Move To Spec' plugin
Reply With Quote #34

Quote:
Originally Posted by Marttt View Post
Create a timer and put where is SendPlayerToSpectators(var), then inside the timer function you call the SendPlayerToSpectators(client) again. (Don't forget to pass ClientUserId instead ClientId inside the timer)
Thanks.
Et3rnity 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 08:05.


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