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

prometheus - Sourcemod Donation System


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Star0
Junior Member
Join Date: Jan 2019
Old 06-02-2022 , 01:52   prometheus - Sourcemod Donation System
Reply With Quote #1

hello guys can anyone help me upgrading
prometheus - Sourcemod Donation System from sourceban to sourceban++

PHP Code:
#tryinclude <sourcebans>
#tryinclude <sb_admins> 
PHP Code:
    // If Sourcebans is enabled, add them to the SB database
    
if (GetConVarInt(cvarMode) == 3)
    {
        if (
LibraryExists("sb_admins")) SB_AddAdmin(0nameAUTHMETHOD_STEAMsteamid""flGroup);
    }
    
ServerCommand("sm_reloadadmins");
    if (
cccCreateTimer(3.0ReloadCCC);
    
    
char broadcast[1024];
    
GetConVarString(cvarBroadcastbroadcastsizeof(broadcast));
    
ReplaceString(broadcastsizeof(broadcast), "PLAYER_NAME"nametrue);
    
ReplaceString(broadcastsizeof(broadcast), "DONATION_AMOUNT"dAmounttrue);
    
ReplaceString(broadcastsizeof(broadcast), "PACKAGE_NAME"packageNametrue);
    if (
csgoPrintToChatAll(broadcast);
    else 
CPrintToChatAll(broadcast);
    
PrintToServer(broadcast);
    
    return 
Plugin_Handled;

PHP Code:
public Action Timer_CheckInterval(Handle timer)
{
    
char strExpires[66], steamid[32];
    
Handle kvdb CreateKeyValues("Prometheus");
    
Handle DB CreateKeyValues("Admins");
    
FileToKeyValues(kvdbKVPath);
    if (!
KvGotoFirstSubKey(kvdb)) return Plugin_Continue;
    do
    {
        
KvGetString(kvdb"expire_time"strExpiressizeof(strExpires));
        if (
GetTime() >= StringToInt(strExpires))
        {
            
KvGetString(kvdb"steamid"steamidsizeof(steamid));
            
LogAction(0, -1"%s is now expired, removing rank..."steamid);
            if (
GetConVarInt(cvarMode) == 1)
            {
                
FileToKeyValues(DBKVPathAdmins);
                if (
KvJumpToKey(DBsteamidfalse))
                {
                    
KvDeleteThis(DB);
                    
LogAction(0, -1"%s's rank has been removed."steamid);
                }
            }
            
            if (
GetConVarInt(cvarMode) == 2)
            {
                if (
IsValidAdmin(steamid))
                {
                    
RemoveAdminFromDB(steamid);
                    
LogAction(0, -1"%s's rank has been removed."steamid);
                }
            }
            
            if (
GetConVarInt(cvarMode) == 3)
            {
                
SB_DeleteAdmin(0AUTHMETHOD_STEAMsteamid);
                
LogAction(0, -1"%s's rank has been removed."steamid);
            }
            
KvDeleteThis(kvdb);
        }
    } while (
KvGotoNextKey(kvdb));
    
    
ServerCommand("sm_reloadadmins");
    if (
cccCreateTimer(3.0ReloadCCC);
    
    
KvRewind(DB);
    
KeyValuesToFile(DBKVPathAdmins);
    
CloseHandle(DB);
    
KvRewind(kvdb);
    
KeyValuesToFile(kvdbKVPath);
    
CloseHandle(kvdb);
    
    return 
Plugin_Continue;

i thing my problem in this codes but if not i will leave .sp file
thanks
Attached Files
File Type: sp Get Plugin or Get Source (prometheus.sp - 24 views - 16.6 KB)
Star0 is offline
azalty
AlliedModders Donor
Join Date: Feb 2020
Location: France
Old 06-11-2022 , 07:35   Re: prometheus - Sourcemod Donation System
Reply With Quote #2

The Prometheus sourcemod plugin has a lot of problems, I rewrote a lot of it, but I can't really share the code since it only works for my config, my server and what I want to do with the plugin.
Most of my packages have hard-coded fixes in prometheus.smx because it doesn't do its job properly or doesn't allow modularity.

An example of a bug is that permanent packages give a negative timestamp for the strExpires variable (arg 4) instead of 0.

I use sm_prometheus_mode "2" which saves the donators to a MySQL database. You can use MySQL admins as well as Sourcebans++ and it'll work.

I use:
admin-flatfile.smx
admin-sql-prefetch.smx (the other one doesn't seem to work for me)
sql-admin-manager.smx
__________________
GitHub | Discord: @azalty | Steam

Last edited by azalty; 06-11-2022 at 07:36.
azalty 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:51.


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