Raised This Month: $32 Target: $400
 8% 

Sourcebans 1.x.x API


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jasonbourne
Senior Member
Join Date: Nov 2011
Location: Sydney , AUS
Old 05-23-2012 , 10:07   Sourcebans 1.x.x API
Reply With Quote #1

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

Last edited by Jasonbourne; 06-01-2012 at 07:32.
Jasonbourne is offline
xomp
BANNED
Join Date: Jul 2008
Old 05-23-2012 , 13:18   Re: Sourcebans 1.x.x API
Reply With Quote #2

Can you make sourcebans less terrible?
xomp is offline
Send a message via Skype™ to xomp
Jasonbourne
Senior Member
Join Date: Nov 2011
Location: Sydney , AUS
Old 05-23-2012 , 16:29   Re: Sourcebans 1.x.x API
Reply With Quote #3

well when im finished you could probably build your own web interface quite easily
Jasonbourne is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-24-2012 , 14:38   Re: Sourcebans 1.x.x API
Reply With Quote #4

Quote:
Originally Posted by xomp View Post
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.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-24-2012 , 20:01   Re: Sourcebans 1.x.x API
Reply With Quote #5

Quote:
Originally Posted by Powerlord View Post
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.
__________________
asherkin is offline
Jasonbourne
Senior Member
Join Date: Nov 2011
Location: Sydney , AUS
Old 05-24-2012 , 20:39   Re: Sourcebans 1.x.x API
Reply With Quote #6

^ can i get some feedback on my code
Jasonbourne is offline
Horsedick
AlliedModders Donor
Join Date: Sep 2011
Old 05-25-2012 , 09:25   Re: Sourcebans 1.x.x API
Reply With Quote #7

Quote:
Originally Posted by asherkin View Post
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.
Horsedick is offline
xomp
BANNED
Join Date: Jul 2008
Old 05-25-2012 , 11:16   Re: Sourcebans 1.x.x API
Reply With Quote #8

Quote:
Originally Posted by Jasonbourne View Post
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.
xomp is offline
Send a message via Skype™ to xomp
Jasonbourne
Senior Member
Join Date: Nov 2011
Location: Sydney , AUS
Old 05-25-2012 , 11:26   Re: Sourcebans 1.x.x API
Reply With Quote #9

Quote:
Originally Posted by xomp View Post
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
Jasonbourne is offline
napalm00
Veteran Member
Join Date: Jun 2011
Location: Italy, sadly
Old 05-25-2012 , 11:42   Re: Sourcebans 1.x.x API
Reply With Quote #10

Quote:
Originally Posted by Jasonbourne View Post
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
__________________
napalm00 is offline
Reply


Thread Tools
Display Modes

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 14:33.


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