Raised This Month: $ Target: $400
 0% 

Solved PrintToServer bug?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 02-03-2023 , 15:24   Re: PrintToServer bug?
Reply With Quote #1

I just tried other events including round win, point captured, flag event, and OnClientPostAdmionCheck. In all scenarios the event fired, all of the PrintToChat commands worked, and only 2 out of 4 PrintToServer commands worked. I even added a timer to delay the print. Bug still happens.

I think this is a bug. The PrintToServer command doesn't always seem to fire when a variable is used with the command. No error is produced in server console. No error is printed in the error log. The command is simply ignored.

Edit: I changed the plugin to fire on command. Bug still exists. In the following code only Test 1 and Test 4 lines print to server console. All of the PrintToChat commands worked.

PHP Code:
#pragma semicolon 1
#pragma newdecls required

public Plugin myinfo 
{
    
name "[TF2] Test PrintToServer on command",
    
author "PC Gamer",
    
description "Prints to Server on command",
    
version "PLUGIN_VERSION 1.0",
}

public 
void OnPluginStart()
{
    
RegAdminCmd("sm_testround"Command_RoundTestADMFLAG_SLAY"Testing PrintToServer bug");
}

public 
Action Command_RoundTest(int clientint args)
{
    
PrintToServer("Test 1"); //This line prints
    
PrintToChatAll("Test 1"); //This line prints
    
    
int realplayers 6;
    
PrintToServer("Test 2: There are %i Human Players"realplayers); //This line does not print
    
PrintToChatAll("Test 2: There are %i Human Players"realplayers);    //This line prints
    
    
int hcount 0;
    for (
int i 1i<= MaxClientsi++)
    {
        if(
IsClientInGame(i) && !IsFakeClient(i))
        {
            
hcount++;
        }
    }
    
    
PrintToServer("Test 3: Just kidding. There are really only %i Human Players"hcount); //This line does not print
    
PrintToChatAll("Test 3: Just kidding. There are really only %i Human Players"hcount); //This line prints
    
PrintToServer("Test 4: Done testing PrintToServer commands"); //This line prints
    
PrintToChatAll("Test 4: Done testing PrintToServer commands");//This line prints

    
return Plugin_Handled;        


Last edited by PC Gamer; 02-03-2023 at 15:39.
PC Gamer 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 21:02.


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