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

int with client_print? & problem with entities


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Xandaros
Junior Member
Join Date: Aug 2007
Old 10-17-2008 , 08:36   int with client_print? & problem with entities
Reply With Quote #1

Heya!
How can I print an integer with client_print?
If theres no way, how can I convert from int -> string and from string -> int?

Thanks in advance for answering my stupid questions^^
Xan
PS: Yes... i DID search...

€d!t: I've got another question...
Well, I get the position of an entity using pev... it's a float. now I use floatround, to round it to an integer. However, if I now use set_pev and set the rounded value, the entity will move too far and it is like gone. well, for the client it's still there, 'cut I can see it, but I can walk through it... while doing that, It laggs a little, I think thats because the client thinks you will walk against a wall...

How do I fix that?

Xan

Last edited by Xandaros; 10-17-2008 at 13:27.
Xandaros is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 10-17-2008 , 09:03   Re: int with client_print?
Reply With Quote #2

Code:
// int
new int = 56;
client_print( id, print_chat, "%d", int );

// string to int
new Num;
Num = str_to_num( String );
client_print( id, print_chat, "%d", Num );

// int to string
new LOL[2], who = 25;
num_to_str( who, LOL, sizeof LOL -1 );
client_print( id, print_chat, "%s", LOL ); // It will print the number (who).


// float
new Float:Nice = 0.5;
client_print( id, print_chat, "%f", Nice );

// float to string
new Float:Bye = 50.0, Replace[4];
float_to_str( Bye, Replace, 3 );
client_print( id, print_chat, "%s", Replace );

// string to float
new Float:floaty, String2[] = "HI";
floaty = floatstr( String2 );
__________________
O o
/¯________________________
| IMMA FIRIN' MAH LAZOR!!!
\_¯¯¯
Dores is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-17-2008 , 11:39   Re: int with client_print?
Reply With Quote #3

Quote:
Originally Posted by dor123 View Post
Code:
// string to float
new Float:floaty, String2[] = "HI";
floaty = floatstr( String2 );
Don't you mean:

Code:
// string to float
new Float:floaty, String2[] = "HI";
floaty = str_to_float( String2 );
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Xandaros
Junior Member
Join Date: Aug 2007
Old 10-17-2008 , 13:27   Re: int with client_print? & problem with entities
Reply With Quote #4

Thanks a lot...

However I've got another question... I edited first post.

Xan
Xandaros is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 10-17-2008 , 20:09   Re: int with client_print? & problem with entities
Reply With Quote #5

For new, unrelated questions, make a new thread.

You need to show the code, you're not describing the problem with enough detail.
stupok is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 10-18-2008 , 12:59   Re: int with client_print? & problem with entities
Reply With Quote #6

@Exolent: Isn't floatstr the same?

@Xan: If a pev returns a float, the set_pev to the same pev value must be set as a float as well.
__________________
O o
/¯________________________
| IMMA FIRIN' MAH LAZOR!!!
\_¯¯¯
Dores is offline
Old 10-19-2008, 10:58
Lee
This message has been deleted by Lee.
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 05:39.


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