Raised This Month: $ Target: $400
 0% 

Bad message printing (Bug in binary)?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
grs4
Senior Member
Join Date: Dec 2010
Location: Poland
Old 01-31-2017 , 11:34   Bad message printing (Bug in binary)?
Reply With Quote #1

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

Last edited by grs4; 01-31-2017 at 11:37.
grs4 is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 01-31-2017 , 11:45   Re: Bad message printing (Bug in binary)?
Reply With Quote #2

I don't understand what the problem is. Is it that it is printing it twice?
Either way you're missing one "%0.1f".
__________________
Black Rose is offline
grs4
Senior Member
Join Date: Dec 2010
Location: Poland
Old 01-31-2017 , 12:05   Re: Bad message printing (Bug in binary)?
Reply With Quote #3

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

Last edited by grs4; 01-31-2017 at 12:08.
grs4 is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 01-31-2017 , 12:26   Re: Bad message printing (Bug in binary)?
Reply With Quote #4

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.
__________________
Black Rose is offline
grs4
Senior Member
Join Date: Dec 2010
Location: Poland
Old 01-31-2017 , 12:51   Re: Bad message printing (Bug in binary)?
Reply With Quote #5

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?
grs4 is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 01-31-2017 , 19:23   Re: Bad message printing (Bug in binary)?
Reply With Quote #6

Quote:
Originally Posted by Black Rose View Post
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.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
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:03.


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