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

[INC] CS:S Clan Tags


Post New Thread Reply   
 
Thread Tools Display Modes
motto
Member
Join Date: Aug 2009
Location: Poland
Old 07-07-2011 , 22:33   Re: [INC] CS:S Clan Tags
Reply With Quote #21

God Job!
__________________
217.153.241.222:27015 CS GO [PL] Panika Emeryta

Last edited by motto; 07-07-2011 at 22:55.
motto is offline
TheAvengers2
BANNED
Join Date: Jul 2011
Old 08-03-2011 , 04:00   Re: [INC] CS:S Clan Tags
Reply With Quote #22

Hello, I'd suggest the following revision to your code.

Code:
stock CS_GetClientClanTag(client, String:buffer[], size)
{
    if(!IsValidEdict(client)) return;
    static String:startprop[64];
    static offset = -1;
    
    if (startprop[0] == '\0' || offset == -1)
    {
        new Handle:conf = LoadGameConfigFile("cssclantags");
        if (conf == INVALID_HANDLE)
        {
            ThrowError("Cannot find gamedata/cssclantags.txt");
            return;
        }
        
        if (!GameConfGetKeyValue(conf, "ClanTagStart", startprop, sizeof(startprop))
            || (offset = GameConfGetOffset(conf, "ClanTagStartOffset")) == -1)
        {
            CloseHandle(conf);
            ThrowError("Could not find either ClanTagStart or ClanTagStartOffset in gamedata file");
            return;
        }
        
        CloseHandle(conf);
        
        new start = FindSendPropInfo("CCSPlayer", startprop);
        if (start == -1)
        {
            ThrowError("Could not find netprop \"%s\" on CCSPlayer", startprop);
            return;
        }
        
        offset += start;
    }
    
    GetEntDataString(client, offset, buffer, size);
}
TheAvengers2 is offline
psychonic

BAFFLED
Join Date: May 2008
Old 08-03-2011 , 07:48   Re: [INC] CS:S Clan Tags
Reply With Quote #23

Quote:
Originally Posted by TheAvengers2 View Post
Hello, I'd suggest the following revision to your code.

Code:
stock CS_GetClientClanTag(client, String:buffer[], size)
{
    if(!IsValidEdict(client)) return;
    static String:startprop[64];
    static offset = -1;
    
    if (startprop[0] == '\0' || offset == -1)
    {
        new Handle:conf = LoadGameConfigFile("cssclantags");
        if (conf == INVALID_HANDLE)
        {
            ThrowError("Cannot find gamedata/cssclantags.txt");
            return;
        }
        
        if (!GameConfGetKeyValue(conf, "ClanTagStart", startprop, sizeof(startprop))
            || (offset = GameConfGetOffset(conf, "ClanTagStartOffset")) == -1)
        {
            CloseHandle(conf);
            ThrowError("Could not find either ClanTagStart or ClanTagStartOffset in gamedata file");
            return;
        }
        
        CloseHandle(conf);
        
        new start = FindSendPropInfo("CCSPlayer", startprop);
        if (start == -1)
        {
            ThrowError("Could not find netprop \"%s\" on CCSPlayer", startprop);
            return;
        }
        
        offset += start;
    }
    
    GetEntDataString(client, offset, buffer, size);
}
Why would you pass it an invalid client, let alone an invalid edict?

Edit: not to mention that throwing an error would be the appropriate action, whether it be from the stock or letting SM do it, rather than just ignoring.

Last edited by psychonic; 08-03-2011 at 07:50.
psychonic is offline
ShufflexDD
Senior Member
Join Date: Apr 2011
Location: :noitaɔo˩
Old 09-18-2011 , 12:33   Re: [INC] CS:S Clan Tags
Reply With Quote #24

Code:
public OnClientSettingsChanged(client)
{
	CS_SetClientClanTag(client, "Top 5ive");
}
in my logs:
Code:
L 09/18/2011 - 20:27:24: [SM] Displaying call stack trace for plugin "test.smx":
L 09/18/2011 - 20:27:24: [SM]   [0]  Line 42, C:\Users\Тёма\Desktop\Top 5ive\DeathRun\SourceMod\addons\sourcemod\scripting\include\cssclantags.inc::CS_GetClientClanTag()
L 09/18/2011 - 20:27:24: [SM]   [1]  Line 16, C:\Users\Тёма\Desktop\Top 5ive\DeathRun\SourceMod\addons\sourcemod\scripting\loxn.sp::OnClientSettingsChanged()
how to fix it?
__________________

⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈
Check this website and find out how many functions
it has working with game server together.
ShufflexDD is offline
Send a message via ICQ to ShufflexDD Send a message via Skype™ to ShufflexDD
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 09-18-2011 , 18:07   Re: [INC] CS:S Clan Tags
Reply With Quote #25

You didn't post any error, only the backtrace.
__________________
Peace-Maker is offline
ShufflexDD
Senior Member
Join Date: Apr 2011
Location: :noitaɔo˩
Old 09-19-2011 , 06:17   Re: [INC] CS:S Clan Tags
Reply With Quote #26

how to do without these errors?
__________________

⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈
Check this website and find out how many functions
it has working with game server together.
ShufflexDD is offline
Send a message via ICQ to ShufflexDD Send a message via Skype™ to ShufflexDD
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 09-19-2011 , 17:27   Re: [INC] CS:S Clan Tags
Reply With Quote #27

I'd fix the unknown error by checking, if the client is ingame before trying to set his clantag.

Why don't you just post the logged error?! Secret?
__________________
Peace-Maker is offline
ShufflexDD
Senior Member
Join Date: Apr 2011
Location: :noitaɔo˩
Old 09-21-2011 , 14:32   Re: [INC] CS:S Clan Tags
Reply With Quote #28

thank you!
Quote:
Originally Posted by Peace-Maker View Post
Why don't you just post the logged error?! Secret?
what?
__________________

⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈⇈
Check this website and find out how many functions
it has working with game server together.
ShufflexDD is offline
Send a message via ICQ to ShufflexDD Send a message via Skype™ to ShufflexDD
Starbish
AlliedModders Donor
Join Date: Oct 2011
Location: South Korea
Old 10-12-2011 , 10:31   Re: [INC] CS:S Clan Tags
Reply With Quote #29

Continuing only On Server which makes then by this function?
__________________
Starbish is offline
psychonic

BAFFLED
Join Date: May 2008
Old 10-12-2011 , 10:33   Re: [INC] CS:S Clan Tags
Reply With Quote #30

Quote:
Originally Posted by Starbish View Post
Continuing only On Server which makes then by this function?
psychonic 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 13:06.


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