AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Bad message printing (Bug in binary)? (https://forums.alliedmods.net/showthread.php?t=293417)

grs4 01-31-2017 11:34

Bad message printing (Bug in binary)?
 
Hi, can anyone explain me, how is it possible?

I have this code

PHP Code:

public PrintUserConfiguration(id)
{
    if(!
is_valid_ent(gEntity))
    {
        
client_print(idprint_center"Can't produce text, if entity is not valid! Create new one.");
        return
    }
    
    
client_print(idprint_chat"Copy this text from console, and paste to configuration file of rhis map!");
    
client_print(idprint_chat"===========================");
    
    new 
Float:Origin[3], Float:Mins[3], Float:Max[3], szFormat[128];
    
    
pev(gEntitypev_originOrigin);
    
pev(gEntitypev_minsMins);
    
pev(gEntitypev_maxsMax);

    
formatex(szFormatcharsmax(szFormat), "%0.1f %0.1f %0.1f %0.1f %0.1f %0.1f %0.1f %0.1f",
        
Origin[0], Origin[1], Origin[2],
        
Mins[0], Mins[1], Mins[2],
        
Max[0], Max[1], Max[2]);
    
    
client_print(idprint_chatszFormat);
    
client_print(idprint_consoleszFormat);
    
    
client_print(idprint_chat"===========================");


And when i'm executing this code (once time, and IN MOVING, when i'm standing at one place, it works correctly) i'm getting different origin of player.

Some console output:

Code:

Copy this text from console, and paste to configuration file of rhis map!
===========================
446.7 -410.6 276.0 -100.0 -100.0 -50.0 100.0 100.0
332.9 -408.9 276.0 -100.0 -100.0 -50.0 100.0 100.0
===========================
Copy this text from console, and paste to configuration file of rhis map!
===========================
537.7 -396.4 276.0 -100.0 -100.0 -50.0 100.0 100.0
446.7 -410.6 276.0 -100.0 -100.0 -50.0 100.0 100.0
===========================
Copy this text from console, and paste to configuration file of rhis map!
===========================
601.8 -319.7 276.0 -100.0 -100.0 -50.0 100.0 100.0
537.7 -396.4 276.0 -100.0 -100.0 -50.0 100.0 100.0
===========================
Copy this text from console, and paste to configuration file of rhis map!
===========================
610.9 -240.3 276.0 -100.0 -100.0 -50.0 100.0 100.0
601.8 -319.7 276.0 -100.0 -100.0 -50.0 100.0 100.0
===========================

How Is it possible? I'm getting values of variables once time to variables, so It should be const, and same on print_chat/print_console.

I thinkt it is bug. Waiting for help

Black Rose 01-31-2017 11:45

Re: Bad message printing (Bug in binary)?
 
I don't understand what the problem is. Is it that it is printing it twice?
Either way you're missing one "%0.1f".

grs4 01-31-2017 12:05

Re: Bad message printing (Bug in binary)?
 
Even when I added this missing %0.1f (THIS IS ANOTHER BUG: It should report me "string formated incorrectly, but it doesnt)

it should show these same values. One is print_console, and second is print_chat, where both are showing text from variable "szFormat". So it should show two times same values. One as Print_console, and second as print_chat.

But this is showing different values
Code:


3400.9 160.7 68.0 -100.0 -100.0 -50.0 100.0 100.0 50.0
3431.9 133.0 68.0 -100.0 -100.0 -50.0 100.0 100.0 50.0
========================

Why?

I'm using Last 1.8.3 dev snapshot

Black Rose 01-31-2017 12:26

Re: Bad message printing (Bug in binary)?
 
I think the string format error is when you have too many placeholders, not enough parameters.

I understand the problem now.
I think what you are seeing is a delayed effect. The message in chat will only appear once it is removed from the screen. That happens (in this case) after you have already printed the next message which pushes the previously into the "log".
I'm just guessing though.

grs4 01-31-2017 12:51

Re: Bad message printing (Bug in binary)?
 
Yep, i know this, that message from chat appears in console after a while. But this doesn't explain, how we see different float numbers. Both prints are initialized by one value. So how do we see different?

PRoSToTeM@ 01-31-2017 19:23

Re: Bad message printing (Bug in binary)?
 
Quote:

Originally Posted by Black Rose (Post 2491519)
I understand the problem now.
I think what you are seeing is a delayed effect. The message in chat will only appear once it is removed from the screen. That happens (in this case) after you have already printed the next message which pushes the previously into the "log".
I'm just guessing though.

I agree with you.

@grs4 you see previous float numbers (because of this delay), not just different or random. Just try to print both messages to console or to chat. You can also try to look at console immediately after first printing.


All times are GMT -4. The time now is 21:03.

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