Raised This Month: $51 Target: $400
 12% 

[REQ][CSGO] Limited server access by Points


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ElaMeMamou
Member
Join Date: May 2016
Old 05-28-2016 , 15:15   [REQ][CSGO] Limited server access by Points
Reply With Quote #1

Hello im running cksurf and i want to open other server to the low-rank ppl.. there is anyway to do this? create something to block access from higher ranks and virse-vesa?

ty
ElaMeMamou is offline
Jackol1234
Senior Member
Join Date: Apr 2015
Old 05-28-2016 , 16:11   Re: [REQ][CSGO] Limited server access by Points
Reply With Quote #2

There is no basenative for points that player has but there is one for overall rank:

PHP Code:
/**
 * Gets the server rank of a client
 *
 * @param client     Client's id
 * @return           Server rank as an int
 */
native ckSurf_GetServerRank(client); 
You could probably do something with this. Just look at what your players ranks are currently and do a
PHP Code:
OnClientPostAdminCheck()
{
     if (
ckSurf_GetServerRank(client) < 50)
     {
          
KickClient(client"This server is only for low ranks.");
     }

This would kick anyone above the rank of 50. It's not the best solution but without making another native it's probably your best bet unless you want to grab the MySQL database and then you could kick based on points.

Last edited by Jackol1234; 05-29-2016 at 14:43. Reason: Fixed < symbol
Jackol1234 is offline
Deathknife
Senior Member
Join Date: Aug 2014
Old 05-29-2016 , 05:33   Re: [REQ][CSGO] Limited server access by Points
Reply With Quote #3

Quote:
Originally Posted by Jackol1234 View Post
There is no basenative for points that player has but there is one for overall rank:

PHP Code:
/**
 * Gets the server rank of a client
 *
 * @param client     Client's id
 * @return           Server rank as an int
 */
native ckSurf_GetServerRank(client); 
You could probably do something with this. Just look at what your players ranks are currently and do a
PHP Code:
OnClientPostAdminCheck()
{
     if (
ckSurf_GetServerRank(client) > 50)
     {
          
KickClient(client"This server is only for low ranks.");
     }

This would kick anyone above the rank of 50. It's not the best solution but without making another native it's probably your best bet unless you want to grab the MySQL database and then you could kick based on points.
You should probably invert that > sign. The lower the rank, the better the player is.
__________________
Deathknife is offline
Jackol1234
Senior Member
Join Date: Apr 2015
Old 05-29-2016 , 14:42   Re: [REQ][CSGO] Limited server access by Points
Reply With Quote #4

Quote:
Originally Posted by Deathknife View Post
You should probably invert that > sign. The lower the rank, the better the player is.
You are correct. Typed that up pretty fast, thanks for pointing it out.
Jackol1234 is offline
ElaMeMamou
Member
Join Date: May 2016
Old 05-29-2016 , 14:58   Re: [REQ][CSGO] Limited server access by Points
Reply With Quote #5

i dont get it... rank 50? Cksurf dont have ranks by numbers...

im missing something?
ElaMeMamou is offline
Jackol1234
Senior Member
Join Date: Apr 2015
Old 05-29-2016 , 16:29   Re: [REQ][CSGO] Limited server access by Points
Reply With Quote #6

Quote:
Originally Posted by ElaMeMamou View Post
i dont get it... rank 50? Cksurf dont have ranks by numbers...

im missing something?
ckSurf does have ranks using numbers. Type !top and go to overall players to see them.
Jackol1234 is offline
Jackol1234
Senior Member
Join Date: Apr 2015
Old 05-30-2016 , 00:49   Re: [REQ][CSGO] Limited server access by Points
Reply With Quote #7

I threw this together. Can't guarantee that it'll work, but it did compile:

PHP Code:
#include <ckSurf>

#pragma semicolon 1

#define PLUGIN_VERSION "0.1"

public Plugin:myinfo =
{
    
name "ckSurf Kicker",
    
author "DeweY",
    
version PLUGIN_VERSION,
    
description "Kicks clients with 1000 points or more.",
    
url "http://Omegagaming.org/"
};

Handle g_hDatabase null;

char g_sSteamID[MAXPLAYERS+1][64];

public 
void OnPluginStart()
{
    
SQL_TConnect(SQLCallback_Connect"ckSurf");
}

public 
SQLCallback_Connect(Handle ownerHandle hndl, const char[] errorany data)
{
    if (
hndl == null)
    {
        
SetFailState("Error connecting to database. %s"error);
    }

    
g_hDatabase hndl;
}

public 
void OnClientPostAdminCheck(client)
{
    
GetClientAuthId(clientAuthId_SteamID64g_sSteamID[client], sizeof(g_sSteamID[]));
    
CheckRank(client);
}

public 
CheckRank(int client)
{
    
char query[255];
    
Format(query255"SELECT `points` FROM `ck_playerrank` WHERE `steamid`='%s' LIMIT 1"g_sSteamID[client]);
    
SQL_TQuery(g_hDatabaseSQLCallback_LoadPlayerPointsqueryGetClientUserId(client));
}

public 
SQLCallback_LoadPlayerPoints(Handle ownerHandle hndl, const char[] errorany data)
{
    if (
hndl == null)
    {
        
SetFailState("Error grabbing player points. %s"error);
    }

    
int client GetClientOfUserId(data);


    if (
SQL_GetRowCount(hndl) == 1)
    {
        
SQL_FetchRow(hndl);
        
int playerpoints SQL_FetchInt(hndl0);
        if (
playerpoints >= 1000)
        {
            
KickClient(client"This server is for beginners.");
        }
    }

Jackol1234 is offline
ElaMeMamou
Member
Join Date: May 2016
Old 05-30-2016 , 02:53   Re: [REQ][CSGO] Limited server access by Points
Reply With Quote #8

deleted this

Last edited by ElaMeMamou; 05-30-2016 at 03:07.
ElaMeMamou is offline
ElaMeMamou
Member
Join Date: May 2016
Old 05-30-2016 , 03:07   Re: [REQ][CSGO] Limited server access by Points
Reply With Quote #9

Quote:
Originally Posted by Jackol1234 View Post
I threw this together. Can't guarantee that it'll work, but it did compile:

PHP Code:
#include <ckSurf>

#pragma semicolon 1

#define PLUGIN_VERSION "0.1"

public Plugin:myinfo =
{
    
name "ckSurf Kicker",
    
author "DeweY",
    
version PLUGIN_VERSION,
    
description "Kicks clients with 1000 points or more.",
    
url "http://Omegagaming.org/"
};

Handle g_hDatabase null;

char g_sSteamID[MAXPLAYERS+1][64];

public 
void OnPluginStart()
{
    
SQL_TConnect(SQLCallback_Connect"ckSurf");
}

public 
SQLCallback_Connect(Handle ownerHandle hndl, const char[] errorany data)
{
    if (
hndl == null)
    {
        
SetFailState("Error connecting to database. %s"error);
    }

    
g_hDatabase hndl;
}

public 
void OnClientPostAdminCheck(client)
{
    
GetClientAuthId(clientAuthId_SteamID64g_sSteamID[client], sizeof(g_sSteamID[]));
    
CheckRank(client);
}

public 
CheckRank(int client)
{
    
char query[255];
    
Format(query255"SELECT `points` FROM `ck_playerrank` WHERE `steamid`='%s' LIMIT 1"g_sSteamID[client]);
    
SQL_TQuery(g_hDatabaseSQLCallback_LoadPlayerPointsqueryGetClientUserId(client));
}

public 
SQLCallback_LoadPlayerPoints(Handle ownerHandle hndl, const char[] errorany data)
{
    if (
hndl == null)
    {
        
SetFailState("Error grabbing player points. %s"error);
    }

    
int client GetClientOfUserId(data);


    if (
SQL_GetRowCount(hndl) == 1)
    {
        
SQL_FetchRow(hndl);
        
int playerpoints SQL_FetchInt(hndl0);
        if (
playerpoints >= 1000)
        {
            
KickClient(client"This server is for beginners.");
        }
    }


Dont work mate.. plugin load fine but dont kick the player.. (using ckSurf as db)

any idea? ty

Last edited by ElaMeMamou; 05-30-2016 at 03:29.
ElaMeMamou is offline
Jackol1234
Senior Member
Join Date: Apr 2015
Old 05-30-2016 , 03:17   Re: [REQ][CSGO] Limited server access by Points
Reply With Quote #10

Change the "ckSurf" on the TConnect line here:
PHP Code:
public void OnPluginStart() 

    
SQL_TConnect(SQLCallback_Connect"ckSurf"); 

To whatever you use to connect to ckSurf in database.cfg. It is case sensitive which is probably where I messed it up.

Edit to stop double post:
Quote:
Originally Posted by ElaMeMamou View Post
Dont work mate.

its load fine but dont kick the player... nothing happen =((
Did you get anymore errors? I can add a logging function in to see where it's going wrong if it didn't give any errors by itself.

Last edited by Jackol1234; 05-30-2016 at 03:31.
Jackol1234 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 12:59.


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