AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [Any][MySQL] tVip (2.3 | 04-04-21) - The simplest to use Vip Manager (https://forums.alliedmods.net/showthread.php?t=292183)

Totenfluch 12-31-2016 09:46

[Any][MySQL] tVip (2.3 | 04-04-21) - The simplest to use Vip Manager
 
3 Attachment(s)
Hey0,

Today I'm going to present a Plugin to you that is available in other forms but not with this featureset.


This Plugin allows you to add Vips on the fly to your Server, extend their Status or Remove them.
You can also lookup the details of Vips in a simple to use Menu.

The Plugin was designed for Large Communities that run a big amount of servers.
This is why it has a live MySQL Sync. This means no data is stored locally and everything is instantly synced to the database to allow a seamless workflow.


Let's get to the details.

INSTALLATION:
- IT WON'T WORK WITHOUT DOING THIS -
Quote:

The default MySQL config is tVip which needs to be added to your database.cfg.
If you want another name, change line 13 in the .sp
Spoiler


There is a config called tVip under cfg/soucemod that allow you to change the flag.

The following commands are available:

Quote:

sm_tvip - Root Flag - Opens the tVip Admin menu
sm_addvip "<SteamID>" <Duration in Month> "<Name>" [0/default=Month,1=Minutes]- Root Flag - Add a Vip manually (offline)
sm_removevip "<SteamID>" - Root Flag - Removes a Vip manually (offline)
sm_vips - no flag - Shows all VIPs
sm_vip - Displays the Start date, End date and duration of the Status in a menu
Command examples:

PHP Code:

sm_addvip "STEAM_1:0:0000000" 60 "Totenfluch" 

^ Gives the User 60 Minutes of Vip


PHP Code:

sm_addvip "STEAM_1:0:0000000" 60 "Totenfluch" 

^ Gives the User 60 Month of Vip


PHP Code:

sm_addvip "STEAM_1:0:0000000" 1440 "Totenfluch" 

^ Gives the User 1440 Minutes (24h = 1 day) of Vip

Config:
Quote:

// This file was auto-generated by AutoExecConfig read and append beta
// ConVars for plugin "tVip.smx"


// 20=Custom6, 19=Custom5 etc. Numeric Flag See: 'https://wiki.alliedmods.net/Checking_Admin_Flags_(SourceMod_Scripting)' for Definitions ---- Multiple flags seperated with Space: '16 17 18 19' !!
// -
// Default: "19"
tVip_flag "19 20"

// Test Vip duration in minutes
// -
// Default: "15"
tVip_testVipDuration "15"
Compatible Plugins:
[ANY] Reserved Slots with tVip support

That's about it.
I hope it's usefull for some of you.

If you are interested in other Plugins (Zephstore parts & more), checkout my Website

Images:

http://i.imgur.com/I5tfEoQ.png
http://i.imgur.com/DgH8uyH.png
http://i.imgur.com/1qmAYHw.png
http://i.imgur.com/WwqS7uZ.png
http://i.imgur.com/Oi93VMh.png
http://i.imgur.com/ovPRG4E.png

Natives and forwards:
PHP Code:

/**
 * Grant vip to a client.
 *
 * @param admin          Admin that set VIP.
 * @param client         Client that will recive VIP.
 * @param duration        Vip duration.
 * @param format         Time format, 1 = Minutes - 0 = Month.
 * @noreturn
 * @error                Invalid client/admin Index or invalid format.
 */
native void tVip_GrantVip(int clientint adminint durationint format 1);



/**
 * Delete Vip from database.
 *
 * @param SteamId          Client SteamID.
 * @noreturn
 */
native void tVip_DeleteVip(char SteamId[20]);

/**
 * Forward on Client pre loaded - Vip is about to be loaded
 *
 * @param2 -> int client
 *
 */
forward void tVip_OnClientLoadedPre(int client);


/**
 * Forward on Client post loaded - Vip for client has loaded and is set in flags
 *
 * @param2 -> int client
 *
 */
forward void tVip_OnClientLoadedPost(int client); 

Troubleshooting:

- Invalid Database Handle
fix your database.cfg

- Table does not create but Database Handle is correct
run
Code:

SET SQL_MODE='ALLOW_INVALID_DATES';
in your MySQL Database

Changelog:

Quote:

2.3
* change default date to CURRENT_TIMESTAMP as it is compatible with more databases
2.2
+ add option to add vip using minutes
2.1
+ added natives Thanks @Hexer10
2.0
* Generic Steam ID storage - thanks zeph
* bugfix in extend
* to update you need to drop your tables
1.8
* fixed mysql alter table bug from 1.4/1.5
1.7
* changed some words
1.6
* allows the update of a player on added
1.4/1.5
+ added sm_removevip command
* allowed sm_addvip to be used by the console
1.3
* fixed out of bounds exception in config
1.2
+ Added Multiple Flag Support
+ Added Test Vip
+ Added sm_vip Command
1.1
- Removed Smlib
+ Added Config file for the Flag
1.0 Init

Github: https://github.com/Totenfluch/tVip

Download Count: 2108

xines 12-31-2016 10:46

Re: [Any] tVip (1.0 | 31-12-16) - The simplest to use Vip Manager
 
Looks really good, and for sure a upgrade!

Pros: Promising script, with a easy to use menu, nice release! :up:
Cons: Code Could need a bit more optimization and readability, nothing major.

Totenfluch 12-31-2016 10:53

Re: [Any] tVip (1.0 | 31-12-16) - The simplest to use Vip Manager
 
Quote:

Originally Posted by xines (Post 2482253)
Looks really good, and for sure a upgrade!

Pros: Promising script, with a easy to use menu, nice release! :up:
Cons: Code Could need a bit more optimization and readability, nothing major.


> public Action cmdAddVip(int client, int args) ?

It's a bit messy but I'm not sure how to otimize it without damaging the functionality


Everything else looks fine from my side and standard coding guidelines are enforced in 99% of all lines.

What did you find that needs optimization?

xines 12-31-2016 11:11

Re: [Any] tVip (1.0 | 31-12-16) - The simplest to use Vip Manager
 
Quote:

Originally Posted by Totenfluch (Post 2482254)
What did you find that needs optimization?

You are welcome to add me and i'll provide some improvements, but as i already said, it's nothing major. Overall it looks promising, i won't spam this thread with improments as you and i would hate that aswell. :up:

Orgy 12-31-2016 17:18

Re: [Any] tVip (1.0 | 31-12-16) - The simplest to use Vip Manager
 
Quote:

The default MySQL config is tVip which needs to be added to your database.cfg.
I think this is where I'm having an issue, I don't quite understand what you mean by this, and due to it I believe I'm getting a startup plugin error.

Totenfluch 12-31-2016 20:54

Re: [Any] tVip (1.0 | 31-12-16) - The simplest to use Vip Manager
 
Quote:

Originally Posted by Orgy (Post 2482345)
I think this is where I'm having an issue, I don't quite understand what you mean by this, and due to it I believe I'm getting a startup plugin error.


http://i.imgur.com/dHgqsnI.png
http://i.imgur.com/vDFq4nI.png

Xenoadria 01-02-2017 06:20

Re: [Any] tVip (1.0 | 31-12-16) - The simplest to use Vip Manager
 
Is it possible to use this plugin with sqlite ?
So it uses local storage for each server?

Edit:
Also if I would like to change flag in .sp line 21; int g_iFlag = 19;
Should be int g_iFlag = 0 (if I would like flag A ) ?

Edit#2:
I am retarded regarding this compiling, how exactly am I supposed to do this ?

Sorry for so many questions.
Great plugin, it does exactly what I wanted for some time now. Thank you for this

Totenfluch 01-02-2017 10:45

Re: [Any] tVip (1.0 | 31-12-16) - The simplest to use Vip Manager
 
Quote:

Is it possible to use this plugin with sqlite ?
Since I'm not fluent in sqlite and MySQL is the better choice in my opinion no

Quote:

So it uses local storage for each server?
This kind of ruins the idea of the plugin. But if you want just use different databases or alter the table name in the sp

Quote:

Also if I would like to change flag in .sp line 21; int g_iFlag = 19;
Should be int g_iFlag = 0 (if I would like flag A ) ?
Theoretically Yes. Your VIPs will get the A flag. Practically I can't say if it gives the users actual permissions in the base sourcemod Admin menu. That's something you have to test. But you got the Idea.

Quote:

I am retarded regarding this compiling, how exactly am I supposed to do this ?
https://wiki.alliedmods.net/Compiling_SourceMod_Plugins
or https://spider.limetech.io/
The only requirements are multicolors.inc ( https://github.com/Bara20/Multi-Colo...ulticolors.inc and https://github.com/bcserv/smlib/tree...ipting/include )

Quote:

Sorry for so many questions.
np

Quote:

Great plugin, it does exactly what I wanted for some time now.
Thanks.

Xenoadria 01-02-2017 11:08

Re: [Any] tVip (1.0 | 31-12-16) - The simplest to use Vip Manager
 
Quote:

Originally Posted by Totenfluch (Post 2482702)

First of all thank you for the answers. I've tried to compile the plugin with this compiler: https://spider.limetech.io/
I've included multicolors.inc and then I get the following error:
Spoiler


So I figured maybe I need to include smlib.inc aswell.
Which I did, and this error occurs:
Spoiler

Totenfluch 01-02-2017 11:22

Re: [Any] tVip (1.0 | 31-12-16) - The simplest to use Vip Manager
 
I'll get that dependency out tomorrow it's just a convenience for me and not needed.

The full smlib can be found here:
https://github.com/bcserv/smlib/tree...ipting/include


All times are GMT -4. The time now is 23:56.

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