AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Write file (ID.txt) (https://forums.alliedmods.net/showthread.php?t=27822)

BloodyNuker 04-30-2006 12:24

Write file (ID.txt)
 
:roll: 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
:D

Greenberet 04-30-2006 13:17

Code:
static text[256]; formatex( text, 255, "addons/amxmodx/acalight/%i.txt", id ); write_file( text ); if(file_exists( text ))

v3x 04-30-2006 19:23

You should name it by their Steam id instead of their regular id.

BloodyNuker 05-02-2006 13:16

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).


:D Tnkz

v3x 05-02-2006 13:55

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 }

BloodyNuker 05-02-2006 18:29

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?

FatalisDK 05-02-2006 18:42

Code:
formatex( text, 255, "addons/amxmodx/acalight/%i.txt", ip ); -> formatex( text, 255, "addons/amxmodx/acalight/%s.txt", ip );

BloodyNuker 05-02-2006 21:34

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 );

FatalisDK 05-02-2006 21:38

Code:
formatex( text, 255, "addons/amxmodx/acalight/%s-%s.txt", ip , name );

BloodyNuker 05-03-2006 12:14

Tnkz FatalistDK :P !!!
this work perfect :D


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 ); }


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

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