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

Timer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BeNq!
Senior Member
Join Date: Mar 2009
Old 01-05-2018 , 18:09   Timer
Reply With Quote #1

Hello,

I have a problem.

Code:
L 01/06/2018 - 00:05:48: [SM] Plugin "csgo_tbm.smx" encountered error 23: Native detected error
L 01/06/2018 - 00:05:48: [SM] Invalid timer handle bc90ca4 (error 3) during timer end, displayed function is timer callback, not the stack trace
L 01/06/2018 - 00:05:48: [SM] Unable to call function "ShowTeamPanel" due to above error(s).
L 01/06/2018 - 00:05:48: [SM] Plugin "csgo_tbm.smx" encountered error 23: Native detected error
L 01/06/2018 - 00:05:48: [SM] Invalid timer handle bd40c5f (error 3) during timer end, displayed function is timer callback, not the stack trace
L 01/06/2018 - 00:05:48: [SM] Unable to call function "ShowTeamPanel" due to above error(s).
L 01/06/2018 - 00:05:48: [SM] Plugin "csgo_tbm.smx" encountered error 23: Native detected error
L 01/06/2018 - 00:05:48: [SM] Invalid timer handle bd50cc4 (error 3) during timer end, displayed function is timer callback, not the stack trace
L 01/06/2018 - 00:05:48: [SM] Unable to call function "ShowTeamPanel" due to above error(s).
L 01/06/2018 - 00:06:07: [SM] Plugin "csgo_tbm.smx" encountered error 23: Native detected error
L 01/06/2018 - 00:06:07: [SM] Invalid timer handle fcf0ccb (error 3) during timer end, displayed function is timer callback, not the stack trace
L 01/06/2018 - 00:06:07: [SM] Unable to call function "ShowTeamPanel" due to above error(s).
L 01/06/2018 - 00:06:09: [SM] Plugin "csgo_tbm.smx" encountered error 23: Native detected error
L 01/06/2018 - 00:06:09: [SM] Invalid timer handle 10930c9a (error 3) during timer end, displayed function is timer callback, not the stack trace
L 01/06/2018 - 00:06:09: [SM] Unable to call function "ShowTeamPanel" due to above error(s).
L 01/06/2018 - 00:06:10: [SM] Plugin "csgo_tbm.smx" encountered error 23: Native detected error
L 01/06/2018 - 00:06:10: [SM] Invalid timer handle 10db0c90 (error 3) during timer end, displayed function is timer callback, not the stack trace
L 01/06/2018 - 00:06:10: [SM] Unable to call function "ShowTeamPanel" due to above error(s).
L 01/06/2018 - 00:06:12: [SM] Plugin "csgo_tbm.smx" encountered error 23: Native detected error
L 01/06/2018 - 00:06:12: [SM] Invalid timer handle 11140c90 (error 3) during timer end, displayed function is timer callback, not the stack trace
L 01/06/2018 - 00:06:12: [SM] Unable to call function "ShowTeamPanel" due to above error(s).
L 01/06/2018 - 00:06:12: [SM] Plugin "csgo_tbm.smx" encountered error 23: Native detected error
L 01/06/2018 - 00:06:12: [SM] Invalid timer handle 11280c8f (error 3) during timer end, displayed function is timer callback, not the stack trace
L 01/06/2018 - 00:06:12: [SM] Unable to call function "ShowTeamPanel" due to above error(s).
L 01/06/2018 - 00:06:13: [SM] Plugin "csgo_tbm.smx" encountered error 23: Native detected error
L 01/06/2018 - 00:06:13: [SM] Invalid timer handle 11610c8f (error 3) during timer end, displayed function is timer callback, not the stack trace
L 01/06/2018 - 00:06:13: [SM] Unable to call function "ShowTeamPanel" due to above error(s).
L 01/06/2018 - 00:06:38: [SM] Plugin "csgo_tbm.smx" encountered error 23: Native detected error
L 01/06/2018 - 00:06:38: [SM] Invalid timer handle 1ad20c90 (error 3) during timer end, displayed function is timer callback, not the stack trace
L 01/06/2018 - 00:06:38: [SM] Unable to call function "ShowTeamPanel" due to above error(s).
L 01/06/2018 - 00:06:40: [SM] Plugin "csgo_tbm.smx" encountered error 23: Native detected error
L 01/06/2018 - 00:06:40: [SM] Invalid timer handle 1be40c3d (error 3) during timer end, displayed function is timer callback, not the stack trace
L 01/06/2018 - 00:06:40: [SM] Unable to call function "ShowTeamPanel" due to above error(s).
Code

PHP Code:
public Action CommandJoinTeam(int client, const char[] commandint argc) {
    if(
PluginCvar(ECEnabled).handle.BoolValue == false || PluginCvar(ECLimitJoin).handle.BoolValue == false)
        return 
Plugin_Continue;

    if(
g_Players[client][EPIsBot])
        return 
Plugin_Continue;

    if(
PluginCvar(ECImmunityJoin).handle.BoolValue == true && (GetUserFlagBits(client) & PluginCvar(ECImmunityFlags).handle.Flags))
        return 
Plugin_Continue;

    if(
PluginCvar(ECLimitAfter).handle.IntValue 0) {
        if(
g_Wart[iRoundNumber] <= PluginCvar(ECLimitAfter).handle.IntValue)
            return 
Plugin_Continue;
    }

    
GetCountPlayersInTeams();
    if(
g_Teams[CS_TEAM_T][ETSize]+g_Teams[CS_TEAM_CT][ETSize] < PluginCvar(ECLimitMin).handle.IntValue)
        return 
Plugin_Continue;

    
char text[32];
    if(
GetCmdArgString(textsizeof(text)) < 1)
        return 
Plugin_Continue;

    
int startidx 0;
    if(
text[strlen(text)-1] == '"') {
        
text[strlen(text)-1] = '\0';
        
startidx 1;
    }

    
int iNewTeam StringToInt(text[startidx]);
    
int iOldTeam g_Players[client][EPTeam];

    if(
iNewTeam == iOldTeam) {
        
TBMPrintToChat(client"%t""Join the same team");
        
TBMShowTeamPanel(client);
        return 
Plugin_Handled;
    }

    if(
iNewTeam CS_TEAM_T)
        return 
Plugin_Continue;

    if(
view(floatg_Players[client][EPBlockTransfer]) > GetEngineTime() && iOldTeam >= CS_TEAM_T) {
        
TBMPrintToChat(client"%t""Stay team");
        
TBMShowTeamPanel(client);
        return 
Plugin_Handled;
    }

    if(
PluginCvar(ECMaxSize).handle.IntValue 0) {
        if(
g_Teams[iNewTeam][ETSize] >= PluginCvar(ECMaxSize).handle.IntValue) {
            
TBMPrintToChat(client"%t""Max size join");
            
TBMShowTeamPanel(client);
            return 
Plugin_Handled;
        }
    }
    else if(
g_Teams[iNewTeam][ETSize] >= MaxClients IntMax(PluginCvar(ECMaxDiff).handle.IntValue1)) {
        
TBMPrintToChat(client"%t""Max size join");
        
TBMShowTeamPanel(client);
        return 
Plugin_Handled;
    }

    
int iOpTeam = (iNewTeam == CS_TEAM_T) ? CS_TEAM_CT CS_TEAM_T;
    if(
g_Teams[iNewTeam][ETSize]-g_Teams[iOpTeam][ETSize] >= PluginCvar(ECMaxDiff).handle.IntValue) {
        
TBMPrintToChat(client"%t""Max diff join");
        
TBMShowTeamPanel(client);
        return 
Plugin_Handled;
    }

    return 
Plugin_Continue;
}

void TBMShowTeamPanel(int client) {
    if(
g_Players[client][EPPanelTimer] != INVALID_HANDLECloseHandle(g_Players[client][EPPanelTimer]);
    
g_Players[client][EPPanelTimer] = CreateTimer(0.8ShowTeamPanelGetClientSerial(client),TIMER_REPEAT);
}

public 
Action ShowTeamPanel(Handle timerany serial) {
    
int client GetClientFromSerial(serial);
    if(
client == || g_Players[client][EPIsConnected] == false || g_Players[client][EPIsBot] == true || IsClientInGame(client) == false)
    {
        
CloseHandle(g_Players[client][EPPanelTimer]);
        
g_Players[client][EPPanelTimer] = INVALID_HANDLE;
        return 
Plugin_Stop;
    }
        
    
CloseHandle(g_Players[client][EPPanelTimer]);
    
g_Players[client][EPPanelTimer] = INVALID_HANDLE;
    
ShowVGUIPanel(client"team");
    
    return 
Plugin_Stop;

How to fix?
BeNq! is offline
headline
SourceMod Moderator
Join Date: Mar 2015
Old 01-05-2018 , 18:41   Re: Timer
Reply With Quote #2

Don't close the timer handle in the timer callback.

I also don't understand why you've made this timer repeat, it seems all code paths in ShowTeamPanel stop the timer on it's first iteration.
headline is offline
BeNq!
Senior Member
Join Date: Mar 2009
Old 01-05-2018 , 19:59   Re: Timer
Reply With Quote #3

Fix:

Quote:
void TBMShowTeamPanel(int client) {
g_Players[client][EPPanelTimer] = CreateTimer(0.8, ShowTeamPanel, GetClientSerial(client),TIMER_REPEAT);
}
?
BeNq! 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 16:14.


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