AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with file_write (https://forums.alliedmods.net/showthread.php?t=127913)

maakera 05-26-2010 11:38

Help with file_write
 
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

drekes 05-26-2010 13:31

Re: Help with file_write
 
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

fysiks 05-26-2010 18:25

Re: Help with file_write
 
Quote:

Originally Posted by drekes (Post 1191853)
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 (Post 1191764)
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


Exolent[jNr] 05-26-2010 19:18

Re: Help with file_write
 
Quote:

Originally Posted by fysiks (Post 1192127)
You cannot concatenate like that in this language. It's not PHP.

That looks like VB.Net syntax.

fysiks 05-26-2010 21:57

Re: Help with file_write
 
Quote:

Originally Posted by Exolent[jNr] (Post 1192176)
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.

Exolent[jNr] 05-26-2010 22:22

Re: Help with file_write
 
AFAIK, PHP uses '.' to concatenate strings.
PHP Code:

$name "lol";
$message "Hello, $name!";
// or
$message "Hello, " $name "!"


fysiks 05-26-2010 23:05

Re: Help with file_write
 
Oh yeah, that's right.

Bugsy 05-27-2010 07:10

Re: Help with file_write
 
Quote:

Originally Posted by Exolent[jNr] (Post 1192176)
That looks like VB.Net syntax.

Even the legacy versions of VB allow you to concatenate like that.


All times are GMT -4. The time now is 05:16.

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