AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   General (https://forums.alliedmods.net/forumdisplay.php?f=58)
-   -   Sourcebans 1.x.x API (https://forums.alliedmods.net/showthread.php?t=185916)

Jasonbourne 05-23-2012 10:07

Sourcebans 1.x.x API
 
SourceBans API

Load a user's info from the database
PHP Code:

require("config.php"); 
define('API_Key'$API_Key); 
require(
"sb_api.php");
$sb->new sb_user();
 
// You only need one line from the following 4, just different ways of loading users
$sb->prepare_user_id(1);                    // loads user info for user with ID number 1
$sb->prepare_user_name("Jason Bourne");                    // load user by Username
$sb->prepare_user_steam("STEAM_0:0:1284406");                    // load user by Steam ID # thanks xomp
$sb->prepare_user_email("[email protected]");                    // load user by Email 

After you have loaded a user you can retrieve information about them
PHP Code:

echo $sb->get_user_id()."</br>";
echo 
$sb->get_user_name()."</br>";
echo 
$sb->get_user_email()."</br>";
echo 
$sb->get_user_steamid()."</br>";
echo 
$sb->get_user_group()."</br>";
echo 
$sb->get_user_flags()."</br>";
echo 
$sb->get_user_immunity()."</br>"

You can edit the currently loaded user
PHP Code:

$sb->set_user_group("vip");
$sb->set_user_immunity(54);
$sb->set_user_flags("abc");
$sb->add_user_flags("sT"); // all input for flags is alphabetized and put into lower case
$sb->remove_user_flags("Z"); 

After manipulating the users data you can update the database
PHP Code:

$sb->update_user(); 

Creating a new user in sourcebans
PHP Code:

$sb->create_user($username,$steamid,$email,$group,$immunity,$flags); // group, immunity, and flags are optional 

Deleting a user from sourcebans
PHP Code:

$sb->delete_user(); //deletes the currently loaded user
$sb->delete_user(id number); // deletes user with that id number 

Unload a user from your web app
PHP Code:

$sb->clear_user(); // unloads the user 

There is also a bunch of validation functions

These are only the user functions

I will be adding server,ban, and group functions as i get more time

http://code.google.com/p/sb-automation/source/browse/

If you want to contribute/ help develop this awesome stuff send me a pm

xomp 05-23-2012 13:18

Re: Sourcebans 1.x.x API
 
Can you make sourcebans less terrible?

Jasonbourne 05-23-2012 16:29

Re: Sourcebans 1.x.x API
 
well when im finished you could probably build your own web interface quite easily :)

Powerlord 05-24-2012 14:38

Re: Sourcebans 1.x.x API
 
Quote:

Originally Posted by xomp (Post 1715110)
Can you make sourcebans less terrible?

If I were still running multiple servers I'd second this.

Seriously, there a mechanism in SourceMod to catch when other plugins ban players, but SourceBans doesn't hook it. Instead, plugins must use the SourceBans include file and manually call SourceBans to do it.

asherkin 05-24-2012 20:01

Re: Sourcebans 1.x.x API
 
Quote:

Originally Posted by Powerlord (Post 1715831)
Seriously, there a mechanism in SourceMod to catch when other plugins ban players, but SourceBans doesn't hook it.

The fun part is that was added specificity for SourceBans at their request.

Jasonbourne 05-24-2012 20:39

Re: Sourcebans 1.x.x API
 
^ can i get some feedback on my code :(

Horsedick 05-25-2012 09:25

Re: Sourcebans 1.x.x API
 
Quote:

Originally Posted by asherkin (Post 1716010)
The fun part is that was added specificity for SourceBans at their request.

If that is the case was it ever acknowledged that they were going to update it with this ability? Shame they don't have the support to adjust it beyond its current state, I just don't know anyone willing to put the work in to help with it or else I'd lobby for that.

xomp 05-25-2012 11:16

Re: Sourcebans 1.x.x API
 
Quote:

Originally Posted by Jasonbourne (Post 1715240)
well when im finished you could probably build your own web interface quite easily :)

I would very much like to have a 'ban page' that shows all the players we've banned. I just don't want to install sourcebans for this functionality :/ However giving folks the ability to make their own web interface with this is a step in the right direction.

Jasonbourne 05-25-2012 11:26

Re: Sourcebans 1.x.x API
 
Quote:

Originally Posted by xomp (Post 1716329)
I would very much like to have a 'ban page' that shows all the players we've banned. I just don't want to install sourcebans for this functionality :/ However giving folks the ability to make their own web interface with this is a step in the right direction.



If your bans are stored.in a mysql db then you dont even need sb :)
I can whip something up if taht is the case

napalm00 05-25-2012 11:42

Re: Sourcebans 1.x.x API
 
Quote:

Originally Posted by Jasonbourne (Post 1715240)
well when im finished you could probably build your own web interface quite easily :)

Looking forward to it, been waiting for a way to add custom plugins to sourcebans for ages :grrr:


All times are GMT -4. The time now is 19:21.

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