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

VAC Status Checker (v.2.5.0 8/27/19)


Post New Thread Reply   
 
Thread Tools Display Modes
StevoTVR
Senior Member
Join Date: Oct 2008
Old 03-01-2017 , 23:41   Re: VAC Status Checker (v.2.0.0 2/21/17)
Reply With Quote #291

Quote:
Originally Posted by Henning View Post
Is it necessary that in the new version all API requests go through your web server?

If so, can you maybe open the source of the script you're hosting on your web server? I would like to host it myself, if it is not too much hassle.
I did it that way so the user wouldn't have to register an API key. It also made it easier for the plugin to consume the data.

This is the server side PHP script. You'll have to register your own key with the Steam Web API and assign it to STEAM_KEY. This also uses the Memcached extension for caching, so you'll need that installed unless you modify the script.
PHP Code:
<?php

header
('Content-Type: text/plain');

define('STEAM_KEY''');
define('CACHE_TIME'1800);
define('CACHE_PREFIX''vacbans_');

$filterOpts = array(
    
'options' => array(
        
'regexp' => '/^\d{17}$/'
    
)
);
$steamId filter_input(INPUT_GET's'FILTER_VALIDATE_REGEXP$filterOpts);
if(
$steamId) {
    
$mc = new Memcached();
    
$mc->addServer('127.0.0.1'11211);
    
$cached $mc->get(CACHE_PREFIX $steamId);
    if(
$cached) {
        echo 
$cached;
    } else {
        
$output fetchFromSteam($steamId);
        if(
$output) {
            
$mc->set(CACHE_PREFIX $steamId$outputCACHE_TIME);
            echo 
$output;
        } else {
            echo 
'null';
        }
    }
} else {
    
header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
    echo 
'null';
}

function 
fetchFromSteam($steamId) {
    
$url sprintf('http://api.steampowered.com/ISteamUser/GetPlayerBans/v1/?key=%s&steamids=%s'STEAM_KEY$steamId);
    
$result file_get_contents($url);
    if(
$result) {
        
$players json_decode($resulttrue);
        if(
is_array($players) && array_key_exists('players'$players) && !empty($players['players'])) {
            
$player $players['players'][0];
            
$output = array(
                
$player['NumberOfVACBans'],
                
$player['DaysSinceLastBan'],
                
$player['NumberOfGameBans'],
                (int)
$player['CommunityBanned'],
                
econValueAsInt($player['EconomyBan'])
            );
            return 
implode(','$output);
        }
        
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
        return 
false;
   }
    
header($_SERVER['SERVER_PROTOCOL'] . ' 503 Service Unavailable');
    return 
false;
}

function 
econValueAsInt($value) {
    switch(
$value) {
        case 
'probation':
            return 
1;
        case 
'banned':
            return 
2;
    }
    return 
0;
}
Not necessary, but if you want the pretty URL structure, here is the .htaccess file:
PHP Code:
<IfModule mod_rewrite.c>
    
RewriteEngine On

    RewriteCond 
%{REQUEST_FILENAME} !-d
    RewriteCond 
%{REQUEST_FILENAME} !-f
    RewriteRule 
^v1/check/(\d+)$ check.php?s=$[QSA,L]
</
IfModule

Last edited by StevoTVR; 03-03-2017 at 00:58.
StevoTVR is offline
rogeraabbccdd
Veteran Member
Join Date: Jun 2015
Location: de_dust2
Old 03-02-2017 , 07:31   Re: VAC Status Checker (v.2.0.0 2/21/17)
Reply With Quote #292

Code:
[SM] Plugin vacbans.smx failed to load: Unable to load plugin (bad header).
SM1.8-5970
__________________

Please keep in mind, nobody have responsibility to help you, especially who don't try to Google first.
I only read messages in Chinese and English.

GitHub | Discord:Kento#2118
rogeraabbccdd is offline
Henning
New Member
Join Date: Jan 2013
Location: Germany
Old 03-03-2017 , 00:29   Re: VAC Status Checker (v.2.0.0 2/21/17)
Reply With Quote #293

Thanks for sharing the PHP script and documenting the dependencies. Setup was straightforward.

But I had to change something in this line:
PHP Code:
$url sprintf('http://api.steampowered.com/ISteamUser/GetPlayerBans/v1/?key=%s&steamids=%d'STEAM_KEY$steamId); 
I changed the %d of $steamId to %s, otherwise a too short number would've been inserted to the URL. Clearly the variable gets converted wrong. Is this a bug or just some PHP weirdness, maybe related to different PHP versions?

Anyway, I only wanted to report/document this, just in case someone else runs into this problem.
__________________
Admin of LiGamers Rats Maps Server (CS:GO)
Henning is offline
StevoTVR
Senior Member
Join Date: Oct 2008
Old 03-03-2017 , 00:57   Re: VAC Status Checker (v.2.0.0 2/21/17)
Reply With Quote #294

Quote:
Originally Posted by Henning View Post
Thanks for sharing the PHP script and documenting the dependencies. Setup was straightforward.

But I had to change something in this line:
PHP Code:
$url sprintf('http://api.steampowered.com/ISteamUser/GetPlayerBans/v1/?key=%s&steamids=%d'STEAM_KEY$steamId); 
I changed the %d of $steamId to %s, otherwise a too short number would've been inserted to the URL. Clearly the variable gets converted wrong. Is this a bug or just some PHP weirdness, maybe related to different PHP versions?

Anyway, I only wanted to report/document this, just in case someone else runs into this problem.
You must be running a 32 bit version of PHP. I'll update my post with your change.
StevoTVR is offline
StevoTVR
Senior Member
Join Date: Oct 2008
Old 03-03-2017 , 11:30   Re: VAC Status Checker (v.2.0.0 2/21/17)
Reply With Quote #295

Quote:
Originally Posted by rogeraabbccdd View Post
Code:
[SM] Plugin vacbans.smx failed to load: Unable to load plugin (bad header).
SM1.8-5970
The compiled smx currently posted loads fine on my test server. Maybe your copy was corrupted somehow.
StevoTVR is offline
rZr
Member
Join Date: Aug 2006
Old 04-21-2017 , 13:14   Re: VAC Status Checker (v.2.0.0 2/21/17)
Reply With Quote #296

Code:
19:12:40 L 04/21/2017 - 19:12:40: [SM] Exception reported: Language phrase "ConVar_CacheTime" not found (arg 6)
19:12:40 L 04/21/2017 - 19:12:40: [SM] Blaming: vacbans.smx
19:12:40 L 04/21/2017 - 19:12:40: [SM] Call stack trace:
19:12:40 L 04/21/2017 - 19:12:40: [SM]   [0] Format
19:12:40 L 04/21/2017 - 19:12:40: [SM]   [1] Line 128, vacbans.sp::OnPluginStart
19:12:40 [SM] Plugin vacbans.smx failed to load: Error detected in plugin startup (see error logs).
19:12:40 L 04/21/2017 - 19:12:40: rcon from "77.23.42.131:61674": command "sm plugins load vacbans"
Metamod:Source version 1.11.0-dev+998
SourceMod Version: 1.9.0.6073

Found:

in the fr translation on Line 14: }

Last edited by rZr; 04-21-2017 at 13:24.
rZr is offline
StevoTVR
Senior Member
Join Date: Oct 2008
Old 04-21-2017 , 15:15   Re: VAC Status Checker (v.2.0.0 2/21/17)
Reply With Quote #297

Quote:
Originally Posted by rZr View Post
Code:
19:12:40 L 04/21/2017 - 19:12:40: [SM] Exception reported: Language phrase "ConVar_CacheTime" not found (arg 6)
19:12:40 L 04/21/2017 - 19:12:40: [SM] Blaming: vacbans.smx
19:12:40 L 04/21/2017 - 19:12:40: [SM] Call stack trace:
19:12:40 L 04/21/2017 - 19:12:40: [SM]   [0] Format
19:12:40 L 04/21/2017 - 19:12:40: [SM]   [1] Line 128, vacbans.sp::OnPluginStart
19:12:40 [SM] Plugin vacbans.smx failed to load: Error detected in plugin startup (see error logs).
19:12:40 L 04/21/2017 - 19:12:40: rcon from "77.23.42.131:61674": command "sm plugins load vacbans"
Metamod:Source version 1.11.0-dev+998
SourceMod Version: 1.9.0.6073

Found:

in the fr translation on Line 14: }
It should be fixed now.
StevoTVR is offline
VieuxGnome
Junior Member
Join Date: Jun 2014
Old 05-11-2017 , 10:38   Re: VAC Status Checker (v.2.0.0 2/21/17)
Reply With Quote #298

Hello,

See in attachement a corrected version of French translation.

Thanks a lot @all for your work !

HF !
VGn
Attached Files
File Type: txt vacbans2.phrases.txt (2.8 KB, 141 views)
VieuxGnome is offline
kleuser
Member
Join Date: Dec 2014
Old 06-11-2017 , 04:30   Re: VAC Status Checker (v.2.0.0 2/21/17)
Reply With Quote #299

Code:
//// vacbans.sp
//
// D:\Dev\sm18\scripting\vacbans.sp(248) : error 092: number of arguments does not match definition
//
// 1 Error.
//
// Compilation Time: 0,3 sec
// ----------------------------------------
Sm 1.8
pls fix
kleuser is offline
StevoTVR
Senior Member
Join Date: Oct 2008
Old 06-11-2017 , 14:01   Re: VAC Status Checker (v.2.0.0 2/21/17)
Reply With Quote #300

Quote:
Originally Posted by kleuser View Post
Code:
//// vacbans.sp
//
// D:\Dev\sm18\scripting\vacbans.sp(248) : error 092: number of arguments does not match definition
//
// 1 Error.
//
// Compilation Time: 0,3 sec
// ----------------------------------------
Sm 1.8
pls fix
Download it again and it should be fixed.
StevoTVR 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 16:40.


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