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

CS_SetClientClanTag not working HELP PLZ


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
juss
Senior Member
Join Date: Jan 2016
Old 09-05-2017 , 14:44   CS_SetClientClanTag not working HELP PLZ
Reply With Quote #1

Trying to replace/add clan tag to once who found in db

not really working , can you guys take a look please


PHP Code:
#include <sourcemod>
#include <cstrike>
#define PLUGIN_VERSION    "1.0"

public Plugin:myinfo = {
    
name "suspect checker",
    
author "forums.alliedmods.net",
    
description "suspect checker",
    
version PLUGIN_VERSION,
    
url "forums.alliedmods.net"
};

new 
Handle:db;

public 
OnPluginStart()
{
    new 
String:error[512];

    
db SQL_Connect("default"trueerrorsizeof(error));

    if(
db == INVALID_HANDLE)
    {
        
SetFailState(error);
    }

}

public 
OnClientPostAdminCheck(client

    
decl String:sQuery[256], String:sAuth[32]; 
    
GetClientAuthId(clientAuthId_EnginesAuthsizeof(sAuth)); 
    
FormatEx(sQuerysizeof(sQuery), "SELECT steam FROM suspects WHERE steam = '%s'"sAuth); 
    
SQL_TQuery(dbSQL_LoadClientsQueryGetClientUserId(client)); 


public 
SQL_LoadClient(Handle:hOwnerHandle:hQuery, const String:sError[], any:UserID

    if (
hQuery == INVALID_HANDLE || sError[0]) 
    { 
        
LogError("SQL_LoadClient: %s"sError); 
    } 
     
    new 
client GetClientOfUserId(UserID); 
    if ( 
client && SQL_FetchRow(hQuery)) 
    {
        if(!
SQL_FetchInt(hQuery0)) 
        {
            
CS_SetClientClanTag(client"[SUSPECTED]");
        }         
    }  


Last edited by juss; 09-05-2017 at 14:49.
juss is offline
psychonic

BAFFLED
Join Date: May 2008
Old 09-05-2017 , 16:08   Re: CS_SetClientClanTag not working HELP PLZ
Reply With Quote #2

Don't send unsolicited PMs to random people to look at your thread. The next one is a ban.
psychonic is offline
BraveFox
AlliedModders Donor
Join Date: May 2015
Location: Israel
Old 09-06-2017 , 00:23   Re: CS_SetClientClanTag not working HELP PLZ
Reply With Quote #3

Instend:
PHP Code:
 if(!SQL_FetchInt(hQuery0)) 
{
            
CS_SetClientClanTag(client"[SUSPECTED]"); 
Use:
PHP Code:
while(SQL_FetchRow(hQuery))
    {
        if(
SQL_FetchInt(hQuery0))
        {
            
//Found Results
        
}
    }

__________________
Contact Me:
Steam: NoyB
Discord: Noy#9999
Taking Private Requests

Last edited by BraveFox; 09-06-2017 at 00:24.
BraveFox is offline
juss
Senior Member
Join Date: Jan 2016
Old 09-06-2017 , 12:07   Re: CS_SetClientClanTag not working HELP PLZ
Reply With Quote #4

Quote:
Originally Posted by BraveFox View Post
Instend:
PHP Code:
 if(!SQL_FetchInt(hQuery0)) 
{
            
CS_SetClientClanTag(client"[SUSPECTED]"); 
Use:
PHP Code:
while(SQL_FetchRow(hQuery))
    {
        if(
SQL_FetchInt(hQuery0))
        {
            
//Found Results
        
}
    }

nope , not working

not sure why i need while here ? I'm checking only one client in mysql select (the player who connects to the server)

Last edited by juss; 09-06-2017 at 13:26.
juss is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 09-06-2017 , 18:11   Re: CS_SetClientClanTag not working HELP PLZ
Reply With Quote #5

Break it down.

Print messages to chat to confirm you're getting a result and it's what you expect.
__________________
Neuro Toxin is offline
pizza_lover
New Member
Join Date: Aug 2017
Old 09-06-2017 , 21:42   Re: CS_SetClientClanTag not working HELP PLZ
Reply With Quote #6

#include <dbi> ?
edit: give it a try
PHP Code:
#include <sourcemod>
#include <cstrike>
#include <dbi>
#define PLUGIN_VERSION    "1.0"

public Plugin:myinfo = {
    
name "suspect checker",
    
author "forums.alliedmods.net",
    
description "suspect checker",
    
version PLUGIN_VERSION,
    
url "forums.alliedmods.net"
};

new 
Handle:db;

public 
OnPluginStart()
{
    new 
String:error[512];

    
db SQL_Connect("default"trueerrorsizeof(error));

    if(
db == INVALID_HANDLE)
    {
        
SetFailState(error);
    }

}

public 
OnClientPostAdminCheck(client)
{
    
decl String:sQuery[256], String:sAuth[32];
    new 
data;
    
GetClientAuthId(clientAuthId_EnginesAuthsizeof(sAuth));
    
data GetClientOfUserId(client);
    
FormatEx(sQuerysizeof(sQuery), "SELECT steam FROM suspects WHERE steam = '%s'"sAuth);
    
SQL_TQuery(dbSQL_LoadClientsQuerydata);
}

public 
SQL_LoadClient(Handle:hOwnerHandle:hQuery, const String:sError[], any:data
{
    new 
client data;
    if (
hQuery == INVALID_HANDLE || sError[0])
    {
        
LogError("SQL_LoadClient: %s"sError);
    }

    if ( 
client && SQL_FetchRow(hQuery))
    {
        if(!
SQL_FetchInt(hQuery0))
        {
            
CS_SetClientClanTag(client"[SUSPECTED]");
        }
    }


Last edited by pizza_lover; 09-06-2017 at 22:01. Reason: added code
pizza_lover is offline
fiction
Member
Join Date: May 2017
Old 09-06-2017 , 23:11   Re: CS_SetClientClanTag not working HELP PLZ
Reply With Quote #7

Quote:
Originally Posted by pizza_lover View Post
#include <dbi> ?
Using #include <sourcemod> includes many of the default includes on it's own, dbi is one of them. Also sourcemod.inc is automatically included by the compiler I believe.

Last edited by fiction; 09-06-2017 at 23:12.
fiction is offline
juss
Senior Member
Join Date: Jan 2016
Old 09-07-2017 , 00:11   Re: CS_SetClientClanTag not working HELP PLZ
Reply With Quote #8

Quote:
Originally Posted by Neuro Toxin View Post
Break it down.

Print messages to chat to confirm you're getting a result and it's what you expect.
I do have PrintToServer and PrintToChat for debagging on my test file , and it prints but the clan tag doesn't want to change

PHP Code:
        if(SQL_FetchInt(hQuery0))
        {
            
CS_SetClientClanTag(client"[SUSPECTED]");
            
PrintToChat(client"found you!!");
            
PrintToServer("1233455667778");
        } 

Last edited by juss; 09-07-2017 at 00:16.
juss is offline
fiction
Member
Join Date: May 2017
Old 09-07-2017 , 00:53   Re: CS_SetClientClanTag not working HELP PLZ
Reply With Quote #9

Quote:
Originally Posted by juss View Post
I do have PrintToServer and PrintToChat for debagging on my test file , and it prints but the clan tag doesn't want to change
What version of SourceMod are you running on your server?
fiction is offline
juss
Senior Member
Join Date: Jan 2016
Old 09-07-2017 , 01:43   Re: CS_SetClientClanTag not working HELP PLZ
Reply With Quote #10

Quote:
Originally Posted by fiction View Post
What version of SourceMod are you running on your server?
SourceMod Version: 1.8.0.6024
juss 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 01:07.


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