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

[REQ] Set mp_force_pick_time 3600 to some steamIDs


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DoomHammer69
Senior Member
Join Date: Aug 2013
Old 11-23-2016 , 14:23   [REQ] Set mp_force_pick_time 3600 to some steamIDs
Reply With Quote #1

Hello everyone!

I am looking for a plugin wich make/force mp_force_pick_time 3600 only to some steamIDs.
For CsGo. Can you help me?
Thanks
__________________


DoomHammer69 is offline
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 11-23-2016 , 16:10   Re: [REQ] Set mp_force_pick_time 3600 to some steamIDs
Reply With Quote #2

Try it
PHP Code:
#include <sourcemod>

#pragma semicolon 1

#define PLUGIN_VERSION "1.0"

public Plugin:myinfo 
{
    
name "Set mp_force_pick_time for steamids",
    
author "CamerDisco/Stevo.TVR",
    
description "The code is from whitelist plugin by Stevo.TVR",
    
version PLUGIN_VERSION,
    
url ""
}

// maximum SteamIDs the plugin can handle; increase value as needed
#define WHITELIST_MAX 255

new String:whitelist[WHITELIST_MAX][64];
new 
listlen;

public 
OnPluginStart()
{
    
RegAdminCmd("sm_cvar_reload"CommandReloadADMFLAG_GENERIC"Reloads server whitelist");
    
RegAdminCmd("sm_cvar_list"CommandListADMFLAG_GENERIC"List all SteamIDs in whitelist");
    
RegAdminCmd("sm_cvar_add"CommandAddADMFLAG_CONVARS"Adds a SteamID to the whitelist");
    
    
    
LoadList();
}

public 
OnClientPostAdminCheck(client)
{
    if(!
IsFakeClient(client))
    {
        new 
String:auth[64];
        
GetClientAuthString(clientauthsizeof(auth));
        for(new 
ilistleni++)
        {
            if(
strcmp(authwhitelist[i]) == 0)
            {
                
SendConVarValue(clientFindConVar("mp_force_pick_time"), "3600");
                break;
            }
        }
    }
}

public 
Action:CommandReload(clientargs)
{
    
LoadList();
    
ReplyToCommand(client"%d SteamIDs loaded from list"listlen);
    return 
Plugin_Handled;
}

public 
Action:CommandList(clientargs)
{
    
PrintToConsole(client" Listing current list (%d items):"listlen);
    for(new 
ilistleni++)
    {
        
PrintToConsole(client"%s"whitelist[i]);
    }
    return 
Plugin_Handled;
}

public 
Action:CommandAdd(clientargs)
{
    if(
args 1)
    {
        
ReplyToCommand(client"[SM] Usage: sm_cvar_add <steamid>");
        return 
Plugin_Handled;
    }
    new 
String:steamid[64];
    
GetCmdArg(1steamidsizeof(steamid));
    
TrimString(steamid);
    
    new 
String:path[PLATFORM_MAX_PATH];
    
BuildPath(PathType:Path_SMpathsizeof(path), "configs/list.txt");
    
    new 
Handle:file OpenFile(path"a");
    if(
file != INVALID_HANDLE)
    {
        
WriteFileLine(filesteamid);
        
whitelist[listlen] = steamid;
        
listlen++;
        
        
ReplyToCommand(client"[SM] %s successfully added to list"steamid);
    }
    else
    {
        
ReplyToCommand(client"[SM] Failed to open %s for writing"path);
    }
    
CloseHandle(file);
    
    return 
Plugin_Handled;
}

public 
LoadList()
{
    new 
String:path[PLATFORM_MAX_PATH];
    
BuildPath(PathType:Path_SMpathsizeof(path), "configs/list.txt");
    
    new 
Handle:file OpenFile(path"r");
    if(
file == INVALID_HANDLE)
    {
        
SetFailState("[Whitelist] Unable to read file %s"path);
    }
    
    
listlen 0;
    new 
String:steamid[64];
    while(!
IsEndOfFile(file) && ReadFileLine(filesteamidsizeof(steamid)))
    {
        if (
steamid[0] == ';' || !IsCharAlpha(steamid[0]))
        {
            continue;
        }
        new 
len strlen(steamid);
        for (new 
ileni++)
        {
            if (
IsCharSpace(steamid[i]) || steamid[i] == ';')
            {
                
steamid[i] = '\0';
                break;
            }
        }
        
whitelist[listlen] = steamid;
        
listlen++;
    }
    
    
CloseHandle(file);

The code for checking steamids is from this plugin: https://forums.alliedmods.net/showthread.php?p=715068 and huge thanks to the author. It's untested, give me information if it'll work! You must put steamid on new file configs/list.txt
__________________


Max-Play.pl - the best polish servers
CamerDisco is offline
DoomHammer69
Senior Member
Join Date: Aug 2013
Old 11-23-2016 , 17:29   Re: [REQ] Set mp_force_pick_time 3600 to some steamIDs
Reply With Quote #3

I have tried. The steamIDs are one in each line. The list.txt is in configs/
The time dont change
No sourcemod error or somthing about the plugin.
__________________


DoomHammer69 is offline
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 11-24-2016 , 04:25   Re: [REQ] Set mp_force_pick_time 3600 to some steamIDs
Reply With Quote #4

I'll test it later. Wait for answer.
__________________


Max-Play.pl - the best polish servers
CamerDisco is offline
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 11-24-2016 , 11:40   Re: [REQ] Set mp_force_pick_time 3600 to some steamIDs
Reply With Quote #5

It's working for me. Look your steamid, especially these two numbers, STEAM_1:0,they can be 1:0, 1:1, 0:0, 0:1
__________________


Max-Play.pl - the best polish servers
CamerDisco 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 07:10.


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