Raised This Month: $ Target: $400
 0% 

Write file (ID.txt)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BloodyNuker
Member
Join Date: Jan 2006
Old 04-30-2006 , 12:24   Write file (ID.txt)
Reply With Quote #1

How can i write a file and this have name of the id player?

Code:
write_file("addons/amxmodx/acalight/" & id & ".txt","nothing",-1);


And how can i show if in the server exist the file i created?
Code:
if (file_exists("addons/amxmodx/acalight/" & id & ".txt"))


Tnkz
BloodyNuker is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 04-30-2006 , 13:17  
Reply With Quote #2

Code:
static text[256]; formatex( text, 255, "addons/amxmodx/acalight/%i.txt", id ); write_file( text ); if(file_exists( text ))
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-30-2006 , 19:23  
Reply With Quote #3

You should name it by their Steam id instead of their regular id.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
BloodyNuker
Member
Join Date: Jan 2006
Old 05-02-2006 , 13:16  
Reply With Quote #4

Code:
public cmdChat(id,level,cid) { if( !is_user_connected(id) ) { return PLUGIN_HANDLED; }   if (!cmd_access(id,level,cid,2)) return PLUGIN_HANDLED new message[192] read_args(message,191) new password[32] = "si" if (equali(message,password)) { static text[256]; formatex( text, 255, "addons/amxmodx/acalight/%i.txt", id ); write_file( text ); } return PLUGIN_HANDLED }








When i compile, i have this error


Code:
/home/users/amxmodx/tmp3/textMFXN70.sma(28) : error 088: number of arguments does not match definition

1 Error.
Could not locate output file /home/groups/amxmodx/public_html/websc3/textMFXN70.amx (compile failed).

Tnkz
BloodyNuker is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-02-2006 , 13:55  
Reply With Quote #5

Try this. I didn't modify your code that much, just indented a bit.
Code:
public cmdChat(id,level,cid) {     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     new message[192]     read_args(message,191)     remove_quotes(message); // remove the quotes     new password[32] /* = "si" NOT a good idea! use copy instead */     copy(password , 32 , "si");     new authid[33];     get_user_authid(id , authid , 32); // get their steamid     if(equali(message,password))     {         static text[256];         formatex( text, 255, "addons/amxmodx/acalight/%i.txt", authid );         write_file( text , steamid , -1 ); // writes their steamid to the end of the file         // you MUST create the 'acalight' directory first!!     }     return PLUGIN_HANDLED }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
BloodyNuker
Member
Join Date: Jan 2006
Old 05-02-2006 , 18:29  
Reply With Quote #6

Tnkz !!! v3x this work!

I modify to use the plugin with IP
I have got another cuestion, if can help me ...
The plugin work perfect but if the players are in the same connection (lan) the ip are equali, how can i put to have a diference? I think put the name of the player before the IP for example "Player200.32.8.65:27005"
How can i do this?


This is correct ?
Code:
formatex( text, 255, "addons/amxmodx/acalight/%s,%i.txt", name , ip );




This is the plugin are working perfect:


Code:
public cmdChat(id,level,cid) { if (!cmd_access(id,level,cid,2)) return PLUGIN_HANDLED new message[192] read_args(message,191) remove_quotes(message); // remove the quotes new password[32] /* = "si" NOT a good idea! use copy instead */ copy(password , 32 , "si"); new ip[33]; get_user_ip(id , ip , 32); // get their ip if(equali(message,password)) { static text[256]; formatex( text, 255, "addons/amxmodx/acalight/%i.txt", ip ); write_file( text , ip , -1 ); // writes their ip to the end of the file // you MUST create the 'acalight' directory first!! } return PLUGIN_HANDLED }


haaa, and where are defining the name of the txt?

I appear 49.txt or 83.txt etc.
Itīs random?
BloodyNuker is offline
FatalisDK
Senior Member
Join Date: Mar 2006
Location: bacon
Old 05-02-2006 , 18:42  
Reply With Quote #7

Code:
formatex( text, 255, "addons/amxmodx/acalight/%i.txt", ip ); -> formatex( text, 255, "addons/amxmodx/acalight/%s.txt", ip );
__________________
FatalisDK is offline
BloodyNuker
Member
Join Date: Jan 2006
Old 05-02-2006 , 21:34  
Reply With Quote #8

Tnkz!, FatalisDK, and what i need put to create a file named (name & ip of the player)



i put this but i donīt know is right

Code:
new name[32]; get_user_name( id , name , 31 ); new ip[33]; get_user_ip(id , ip , 32); new jaja[64]=(ip & name) formatex( text, 255, "addons/amxmodx/acalight/%s.txt", jaja ); write_file( text , ip , -1 );
BloodyNuker is offline
FatalisDK
Senior Member
Join Date: Mar 2006
Location: bacon
Old 05-02-2006 , 21:38  
Reply With Quote #9

Code:
formatex( text, 255, "addons/amxmodx/acalight/%s-%s.txt", ip , name );
__________________
FatalisDK is offline
BloodyNuker
Member
Join Date: Jan 2006
Old 05-03-2006 , 12:14  
Reply With Quote #10

Tnkz FatalistDK !!!
this work perfect


And what must i put to delete the file?
Because i put this, but donīt delete the file


Code:
delete_file( file );


Code:
new ip[33]; get_user_ip(id , ip , 32); // get their ip new numero[33]; get_user_info(id, "aca", numero, 32); formatex( text, 255, "addons/amxmodx/acalight/%s-%s.txt", numero, ip); if(file_exists( text )) { delete_file( text ); }
BloodyNuker 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:13.


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