AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=109)
-   -   [CSGO/CSS?] Upgraded & Fixed VIP System - On Database With Perks (https://forums.alliedmods.net/showthread.php?t=307130)

BraveFox 04-27-2018 15:25

[CSGO/CSS?] Upgraded & Fixed VIP System - On Database With Perks
 
Use this system:
https://forums.alliedmods.net/showth...52#post2647352

OfficialSikari 04-27-2018 16:08

Re: [CSGO] Upgraded & Fixed VIP System - On Database With Perks
 
First of all, Im not here to tell you what to do, but to point some things out.

Code:

if (StrEqual(gB_SteamID, "BOT"))
    return;

You have this piece of code showing up a few times, you should use IsFakeClient() instead.
This would also be a minor optimization if you do it before GetClientAuthId()


I also noticed that you seem to give your local variables the g prefix while your global variables dont have that, in my opinion those should be quite the other way around.

You also seem to prefix your char arrays b which would indicate that its a boolean.
You should use either sz or c for char arrays, or something else that would better indicate that its a char array.

You seem to give your strings "hardcoded" maxlength instead of using sizeof(). Heres an example of line 973.

You should use sizeof(sTest) instead of giving 512 as the maxlength.

Code:

public Action Timer_ApplySkin(Handle timer, any client)
{
    char sTest[512];
    Format(sTest, 512, "%s", clientskin[client]) // Should fix crashes
    PrecacheModel(sTest);
    SetEntityModel(client, sTest);
}

And again, im not complaining. Im pointing out things.

BraveFox 04-27-2018 16:34

Re: [CSGO] Upgraded & Fixed VIP System - On Database With Perks
 
Quote:

Originally Posted by OfficialSikari (Post 2589714)
First of all, Im not here to tell you what to do, but to point some things out.

Code:

if (StrEqual(gB_SteamID, "BOT"))
    return;

You have this piece of code showing up a few times, you should use IsFakeClient() instead.
This would also be a minor optimization if you do it before GetClientAuthId()


I also noticed that you seem to give your local variables the g prefix while your global variables dont have that, in my opinion those should be quite the other way around.

You also seem to prefix your char arrays b which would indicate that its a boolean.
You should use either sz or c for char arrays, or something else that would better indicate that its a char array.

You seem to give your strings "hardcoded" maxlength instead of using sizeof(). Heres an example of line 973.

You should use sizeof(sTest) instead of giving 512 as the maxlength.

Code:

public Action Timer_ApplySkin(Handle timer, any client)
{
    char sTest[512];
    Format(sTest, 512, "%s", clientskin[client]) // Should fix crashes
    PrecacheModel(sTest);
    SetEntityModel(client, sTest);
}

And again, im not complaining. Im pointing out things.

Thanks for the tips, I'm uploading a new version which have a changed syntax and fixed a bug with the vip time left & the expire.

BraveFox 04-27-2018 16:44

Re: [CSGO] Upgraded & Fixed VIP System - On Database With Perks
 
Updated again the sourcecode.

DarkDeviL 04-27-2018 16:58

Re: [CSGO] Upgraded & Fixed VIP System - On Database With Perks
 
public Action Command_AddVIP(int client, int args):

Code:

[...]
                                //Info
                                char playername[MAX_NAME_LENGTH], steamid[32];
                                GetClientName(target_list[i], playername, MAX_NAME_LENGTH);
                                GetClientAuthId(target_list[i], AuthId_Steam2, steamid, 32);
                               
                                int iLength = ((strlen(playername) * 2) + 1);
[...]

public Action Command_RemoveVIP(int client, int args):

Code:

[...]
                        for (int i = 0; i < target_count; i++)
                        {
                                char steamid[64];
                                GetClientAuthId(target_list[i], AuthId_Steam2, steamid, sizeof(steamid));
                                SQL_RemoveVIP(steamid);
                                g_iClientTime[target_list[i]] = 0;
                                b_bIsClientVIP[target_list[i]] = false;
                                PrintToChat(client, "%s%N has been removed from a VIP", prefix, target_list[i]);
                        }
[...]

void UpdatePlayer(int client):

Code:

[...]
        char gB_Query[512], steamid[32];
        GetClientAuthId(client, AuthId_Steam2, steamid, 32);
[...]

public void SQL_InsertPlayer_Callback(Database db, DBResultSet results, const char[] error, any data):

Code:

[...]
        if (SQL_GetRowCount(results) == 0)
        {
                char steamid[64];
                GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid));
                SQL_RemoveVIP(steamid);
        }
[...]

stock void CheckTimeLeft(int client):

Code:

[...]
        char authid[64];
        GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid));
[...]

:nono:

GetClientAuthId gives a boolean value, check it before you use it? :'(

Just like you did in:

public void SQL_SelectPlayer_Callback(Database db, DBResultSet results, const char[] error, any data):

Code:

[...]
        char steamid[32];
        if (!GetClientAuthId(client, AuthId_Steam2, steamid, 32))
        {
                return;
        }
[...]

:shock:

BraveFox 04-27-2018 17:41

Re: [CSGO] Upgraded & Fixed VIP System - On Database With Perks
 
Quote:

Originally Posted by arne1288 (Post 2589718)
public Action Command_AddVIP(int client, int args):

Code:

[...]
                                //Info
                                char playername[MAX_NAME_LENGTH], steamid[32];
                                GetClientName(target_list[i], playername, MAX_NAME_LENGTH);
                                GetClientAuthId(target_list[i], AuthId_Steam2, steamid, 32);
                               
                                int iLength = ((strlen(playername) * 2) + 1);
[...]

public Action Command_RemoveVIP(int client, int args):

Code:

[...]
                        for (int i = 0; i < target_count; i++)
                        {
                                char steamid[64];
                                GetClientAuthId(target_list[i], AuthId_Steam2, steamid, sizeof(steamid));
                                SQL_RemoveVIP(steamid);
                                g_iClientTime[target_list[i]] = 0;
                                b_bIsClientVIP[target_list[i]] = false;
                                PrintToChat(client, "%s%N has been removed from a VIP", prefix, target_list[i]);
                        }
[...]

void UpdatePlayer(int client):

Code:

[...]
        char gB_Query[512], steamid[32];
        GetClientAuthId(client, AuthId_Steam2, steamid, 32);
[...]

public void SQL_InsertPlayer_Callback(Database db, DBResultSet results, const char[] error, any data):

Code:

[...]
        if (SQL_GetRowCount(results) == 0)
        {
                char steamid[64];
                GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid));
                SQL_RemoveVIP(steamid);
        }
[...]

stock void CheckTimeLeft(int client):

Code:

[...]
        char authid[64];
        GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid));
[...]

:nono:

GetClientAuthId gives a boolean value, check it before you use it? :'(

Just like you did in:

public void SQL_SelectPlayer_Callback(Database db, DBResultSet results, const char[] error, any data):

Code:

[...]
        char steamid[32];
        if (!GetClientAuthId(client, AuthId_Steam2, steamid, 32))
        {
                return;
        }
[...]

:shock:

Updated, Thanks.

Zyten 04-27-2018 17:55

Re: [CSGO/CSS?] Upgraded & Fixed VIP System - On Database With Perks
 
seems like name color not working
also its stripped my root rights? after map change :D got them back after database removed alone?
Dosent save database
also vip connect/disconnect message spamm not going off and if u and add person to vip his name spamm under the 1st vip name also u cant put it off





spamming my error logs this line:


L 04/28/2018 - 00:52:23: SourceMod error session started
L 04/28/2018 - 00:52:23: Info (map "jb_leaderminecraft_ll") (file "errors_20180428.log")
L 04/28/2018 - 00:52:23: [csgovip.smx] [CSGOVIP] Client is not valid. Reason:

BraveFox 04-28-2018 03:48

Re: [CSGO/CSS?] Upgraded & Fixed VIP System - On Database With Perks
 
Quote:

Originally Posted by Zyten (Post 2589723)
seems like name color not working
also its stripped my root rights? after map change :D got them back after database removed alone?
Dosent save database
also vip connect/disconnect message spamm not going off and if u and add person to vip his name spamm under the 1st vip name also u cant put it off





spamming my error logs this line:


L 04/28/2018 - 00:52:23: SourceMod error session started
L 04/28/2018 - 00:52:23: Info (map "jb_leaderminecraft_ll") (file "errors_20180428.log")
L 04/28/2018 - 00:52:23: [csgovip.smx] [CSGOVIP] Client is not valid. Reason:

Try now, I've fixed some bugs in the mysql syntax and fixed the connect msg.

BraveFox 04-28-2018 04:44

Re: [CSGO/CSS?] Upgraded & Fixed VIP System - On Database With Perks
 
Quote:

3.2 - Fixed the bug which players's vip expires all the time
New release!

BraveFox 04-28-2018 04:48

Re: [CSGO/CSS?] Upgraded & Fixed VIP System - On Database With Perks
 
Quote:

3.3 - Fixed a bug which crushes the server(player skins).


All times are GMT -4. The time now is 06:35.

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