Raised This Month: $344 Target: $400
 86%   Almost there!

String to number


Post New Thread Reply   
 
Thread Tools Display Modes
Touch
Member
Join Date: Apr 2010
Location: Ukraine
Old 04-07-2010 , 14:16   Re: String to number
Reply With Quote #11

Quote:
Originally Posted by Pawn 3-pg View Post
PHP Code:
IntToString(StringToInt(player) + 1playerstrlen(player)); 
When the database has got the number 88, I was given just 8. What should I do? Because of what happened?
Touch is offline
Send a message via Skype™ to Touch
Pawn 3-pg
Senior Member
Join Date: Jul 2009
Old 04-07-2010 , 14:32   Re: String to number
Reply With Quote #12

Quote:
Originally Posted by Touch View Post
When the database has got the number 88, I was given just 8. What should I do? Because of what happened?

I'm guessing that this is happening because the entire string isn't getting copied somewhere. Try this:
PHP Code:
PrintToChatAll("Before: player = %s"player)
IntToString(StringToInt(player) + 1player65);
PrintToChatAll("After: player = %s"player
I put the PrintToChat lines just to make sure that the string contains what the database does.
Pawn 3-pg is offline
Touch
Member
Join Date: Apr 2010
Location: Ukraine
Old 04-07-2010 , 14:37   Re: String to number
Reply With Quote #13

Before: player = 87
After: player = 88

Very big thanks! It's super!

Last edited by Touch; 04-07-2010 at 14:45. Reason: VeRy
Touch is offline
Send a message via Skype™ to Touch
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 04-07-2010 , 15:13   Re: String to number
Reply With Quote #14

just use sizeof(String)
__________________
Leonardo is offline
Touch
Member
Join Date: Apr 2010
Location: Ukraine
Old 04-07-2010 , 15:21   Re: String to number
Reply With Quote #15

Quote:
Originally Posted by Leonardo View Post
just use sizeof(String)
Ох, спасибо Чуть не забыл)
Touch is offline
Send a message via Skype™ to Touch
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 04-07-2010 , 15:52   Re: String to number
Reply With Quote #16

измеряются здесь не в длине символов а в количестве байтов
вспоминаем, что 1 байт = один символ ASCII (8 бит)
потому sizeof(), вытягивающий размер переменной в памяти, здесь прикручен везде.
присматривайтесь к примерам в хелпе.
__________________
Leonardo is offline
Reply


Thread Tools
Display Modes

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 18:47.


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