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

[STOPPED][TF2] Custom Achievement Manager With MYSQL (V1.1)


Post New Thread Reply   
 
Thread Tools Display Modes
Zuko
SourceMod Donor
Join Date: Sep 2006
Location: Poland
Old 03-26-2010 , 10:53   Re: [TF2] Custom Achievement Manager With MYSQL
Reply With Quote #601

Pfsm999, your plugin still displays wrong achievement progress on chat and players cannot get achievements on my server (progress on site is good eg. 2/2)
__________________
Zuko is offline
Send a message via ICQ to Zuko
Pfsm999
Senior Member
Join Date: Sep 2009
Old 03-26-2010 , 11:23   Re: [TF2] Custom Achievement Manager With MYSQL
Reply With Quote #602

Okay, i see the problem !
And now... normaly : All be correct on the new version !

Just a bad line of code ... i don't know how could be happen ...
See on the first page the new plug !
__________________
Pfsm999 is offline
Zuko
SourceMod Donor
Join Date: Sep 2006
Location: Poland
Old 03-26-2010 , 17:16   Re: [TF2] Custom Achievement Manager With MYSQL
Reply With Quote #603

ok, new version works, thanks
__________________
Zuko is offline
Send a message via ICQ to Zuko
Zuko
SourceMod Donor
Join Date: Sep 2006
Location: Poland
Old 03-27-2010 , 10:37   Re: [TF2] Custom Achievement Manager With MYSQL
Reply With Quote #604

error logs.
http://g2.isports.pl/~zuko/errors_20100326.log
__________________
Zuko is offline
Send a message via ICQ to Zuko
NovaDenizen
Junior Member
Join Date: Jan 2010
Old 03-27-2010 , 11:01   Re: [TF2] Custom Achievement Manager With MYSQL
Reply With Quote #605

Code:
 public Action:blocks_sniper_jarate(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init)
 {
-       CreateTimer(0.1, DelaySniperExpire, bf);
+       new strClient = BfReadByte(bf);
+       new strVictim = BfReadByte(bf);
+       g_VICTIMSNIPER[strClient] = strVictim;
+       CreateTimer(0.1, DelaySniperExpire, strClient);
        return Plugin_Continue;
 }
 
-public Action:DelaySniperExpire(Handle:hTimer, Handle:buffer)
+public Action:DelaySniperExpire(Handle:hTimer, any:argClient)
 {
-       new strClient = BfReadByte(buffer);
-       new strVictim = BfReadByte(buffer);
+       new strClient = argClient;
+       new strVictim = g_VICTIMSNIPER[argClient];
If a sniper jarates 3 people simultaneously then the plugin will instead treat it as one of them getting jarated 3 times. There will be 3 player_jarated messages that happen quickly before the timer runs out. It's not a good idea to use a global variable in this situation.

You instead should use a DataPack, like this:
Code:
 public Action:blocks_sniper_jarate(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init)
 {
       new strClient = BfReadByte(bf);
       new strVictim = BfReadByte(bf);
       new Handle:dp = CreateDataPack();
       WritePackCell(dp, strClient);
       WritePackCell(dp, strVictim);
       CreateTimer(0.1, DelaySniperExpire, dp);
       return Plugin_Continue;
 }
public Action:DelaySniperExpire(Handle:hTimer, any:dp)
 {
       ResetPack(dp);
       new strClient = ReadPackCell(dp);
       new strVictim = ReadPackCell(dp);
       CloseHandle(dp);
NovaDenizen is offline
NovaDenizen
Junior Member
Join Date: Jan 2010
Old 03-27-2010 , 11:19   Re: [TF2] Custom Achievement Manager With MYSQL
Reply With Quote #606

Code:
L 03/26/2010 - 22:53:40: [SM] Native "IsClientConnected" reported: Client index 0 is invalid
L 03/26/2010 - 22:53:40: [SM] Displaying call stack trace for plugin "customs_achievements.smx":
L 03/26/2010 - 22:53:40: [SM]   [0]  Line 1701, customs_achievements.sp::IsValidClient()
L 03/26/2010 - 22:53:40: [SM]   [1]  Line 92, mwach/medic.inc::blocks_medic_uber()
Code:
// ------------------------------------------------------------------------
// IsValidClient
// ------------------------------------------------------------------------
stock bool:IsValidClient(iClient)
{
        if (iClient < 0) return false;
        if (iClient > MaxClients) return false;
        if (!IsClientConnected(iClient)) return false;
        return IsClientInGame(iClient);
}
I think you want to change that one line to:
Code:
        if (iClient <= 0) return false;
NovaDenizen is offline
NovaDenizen
Junior Member
Join Date: Jan 2010
Old 03-27-2010 , 11:45   Re: [TF2] Custom Achievement Manager With MYSQL
Reply With Quote #607

Code:
L 03/26/2010 - 23:16:10: [SM] Native "GetClientAuthString" reported: Client 4 is not connected
L 03/26/2010 - 23:16:10: [SM] Displaying call stack trace for plugin "customs_achievements.smx":
L 03/26/2010 - 23:16:10: [SM]   [0]  Line 1258, customs_achievements.sp::ResetBlockStatus()
L 03/26/2010 - 23:16:10: [SM]   [1]  Line 1131, customs_achievements.sp::ResetFunction()
L 03/26/2010 - 23:16:10: [SM]   [2]  Line 1118, customs_achievements.sp::ResetAllOneLifeForOneClient()
L 03/26/2010 - 23:16:10: [SM]   [3]  Line 333, mwach/kill.inc::blocks_ResetOnDeath()
Code:
//----------------------------------------KILL BLOCKS----------------------------------------
public blocks_kill_pre(Handle:argEvent, const String:name[], bool:noBroadcast) {
        blocks_kill(argEvent, -1, -1);
        new g_victimid = GetEventInt(argEvent, "userid");
        new g_victim = GetClientOfUserId(g_victimid);
        CreateTimer(2.0, blocks_ResetOnDeath, g_victim);
}
I believe this error happens because the victim disconnected before the 2 second timer expired and blocks_ResetOnDeath was called.

I see several ways to approach this problem.

One way is to just put an IsValidClient check in ResetBlockStatus, and return if the client is not valid. This is kind of sketchy because the resets will not be performed.

Another way is to simply reduce the timer length from 2 seconds to 0.1 seconds. I haven't figured out why you're using a timer at all here. Shortening the timer doesn't eliminate the problem but it does make it more unlikely.

The best, and most difficult way, is to call getClientAuthString in blocks_kill_pre, put the steamid in a DataPack, and pass the DataPack through blocks_ResetOnDeath, ResetAllOneLifeForOneClient(), ResetFunction(), and ResetBlockStatus().
NovaDenizen is offline
Pfsm999
Senior Member
Join Date: Sep 2009
Old 03-27-2010 , 14:40   Re: [TF2] Custom Achievement Manager With MYSQL
Reply With Quote #608

Thanks to you NovaDenizen
Done version 1.05 of plug !
And i work for new addon on the website.

And you have a PM Nova ^^
__________________
Pfsm999 is offline
Zuko
SourceMod Donor
Join Date: Sep 2006
Location: Poland
Old 03-28-2010 , 13:28   Re: [TF2] Custom Achievement Manager With MYSQL
Reply With Quote #609

another errors from my log ;]

http://g2.isports.pl/~zuko/errors_20100326.log
__________________
Zuko is offline
Send a message via ICQ to Zuko
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 03-28-2010 , 19:50   Re: [TF2] Custom Achievement Manager With MYSQL
Reply With Quote #610

Please set the plugin description and the public cvar in the thread, approved for now.

Greetings ~Berni
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni 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 03:18.


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