AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Can't write integers to html file? (https://forums.alliedmods.net/showthread.php?t=237822)

Buckshot 03-30-2014 04:10

Can't write integers to html file?
 
Examples:
This works:

PHP Code:

new szString46 ]
new 
szName32 ]
get_user_nameidszname31 )
formatexszString45"<b>Your name is: %s</b>"szName )
write_file"file.html"szString, -

But not this.
PHP Code:

szString32 ]
new 
randomnum random_num1,100 )
formatexszString,  31"<b>The random number is: %s</b>"randomnum )
write_file"file.html"szString, -

Why? All i get is "The random number is:" and nothing after it as the output in the html file .. Some of the times when i tried writing integers to the html file i just got weird outputs like "© ₳" where the integer is supposed to be.. And it's the same if i write any integer into the file. It just doesn't work. Only strings. I am currently making a Chatlog, and i have to check the time of when it was logged, and send that time to the html file.. Everything is working file, but when it's going into the html file is where everything goes wrong.

swapped 03-30-2014 04:20

Re: Can't write integers to html file?
 
Code:

formatex( szString,  31, "<b>The random number is: %s</b>", randomnum )

= >>
Code:

formatex( szString,  31, "<b>The random number is: %i</b>", randomnum )

Kiske 03-30-2014 04:20

Re: Can't write integers to html file?
 
%s for strings.
%d or %i for integers.

Buckshot 03-30-2014 04:31

Re: Can't write integers to html file?
 
Facepalm.. i need some sleep.. 10am and i was up all night. I should not be allowed on alliedmods by this time. I would've known this if i had a working brain.


All times are GMT -4. The time now is 06:02.

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