Raised This Month: $ Target: $400
 0% 

Help with file_write


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
maakera
Member
Join Date: Jul 2009
Old 05-26-2010 , 11:38   Help with file_write
Reply With Quote #1

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <Core>

#define PLUGIN "Register loto"
#define VERSION "1.0"
#define AUTHOR "Ute^^"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /registerloto""Register")
    
// Add your code here...
}


public 
Register(id)
{
    new 
szName[33];
    
get_user_name(idszName32)
write_file("freeloto.html""<LI TYPE=square>" szName "</LI><br>", -1)
return 
PLUGIN_CONTINUE;

show that array must be indexed on line 23
__________________

maakera is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-26-2010 , 13:31   Re: Help with file_write
Reply With Quote #2

Code:
 
new szText[128]
new szFile[64]


formatex(szFile, 63, "freeloto.html")
formatex(szText, 127, "^"<LI TYPE=square>^" & %s & ^"</LI><br>^"",  szName)
write_file(szFile, szText)


I'm not sure if you can write to a .html file though
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-26-2010 , 18:25   Re: Help with file_write
Reply With Quote #3

Quote:
Originally Posted by drekes View Post
I'm not sure if you can write to a .html file though
Sure you can, it's just plain text.

Quote:
Originally Posted by maakera View Post
PHP Code:
write_file("freeloto.html""<LI TYPE=square>" szName "</LI><br>", -1
You cannot concatenate like that in this language. It's not PHP.

Try this:

PHP Code:
    new szString[64]
    
formatex(szStringcharsmax(szString), "<LI TYPE=square>%s</LI><br>"szName)
    
write_file("freeloto.html"szString, -1
__________________
fysiks is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-26-2010 , 19:18   Re: Help with file_write
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
You cannot concatenate like that in this language. It's not PHP.
That looks like VB.Net syntax.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-26-2010 , 21:57   Re: Help with file_write
Reply With Quote #5

Quote:
Originally Posted by Exolent[jNr] View Post
That looks like VB.Net syntax.
It's been too long since I took a VB.Net class. I thought it worked like that in PHP too.
__________________
fysiks is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-26-2010 , 22:22   Re: Help with file_write
Reply With Quote #6

AFAIK, PHP uses '.' to concatenate strings.
PHP Code:
$name "lol";
$message "Hello, $name!";
// or
$message "Hello, " $name "!"
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-27-2010 , 07:10   Re: Help with file_write
Reply With Quote #7

Quote:
Originally Posted by Exolent[jNr] View Post
That looks like VB.Net syntax.
Even the legacy versions of VB allow you to concatenate like that.
__________________
Bugsy is offline
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:16.


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