Raised This Month: $ Target: $400
 0% 

[SOLVED]read first line of .txt file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
padilha007
Senior Member
Join Date: Jul 2008
Old 08-13-2008 , 18:39   [SOLVED]read first line of .txt file
Reply With Quote #1

PHP Code:
public pegar(id) {
new 
data[64]
new 
mapname[32
get_mapname(mapname,31

static 
text[32]; 
formatextext255"addons/amxmodx/configs/spawn/%s.txt"mapname );
fgets(fopen(text"text"), data63)
server_cmd("amx_numb %s"text)

but dont work, dont get any text.

Last edited by padilha007; 08-15-2008 at 18:35.
padilha007 is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 08-13-2008 , 19:13   Re: read first line of .txt file
Reply With Quote #2

PHP Code:
public pegar(id) {
new 
data[64]
new 
mapname[32
get_mapname(mapname,31

static 
text[128]; 
formatextext127"addons/amxmodx/configs/spawn/%s.txt"mapname );
fgets(fopen(text"rt"), data63)
server_cmd("amx_numb %s"data)

data has the first line.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
padilha007
Senior Member
Join Date: Jul 2008
Old 08-13-2008 , 20:24   Re: read first line of .txt file
Reply With Quote #3

my first line is -138 400 60

but your code get just 1 number -138, can i get 3 only?
padilha007 is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 08-14-2008 , 12:56   Re: read first line of .txt file
Reply With Quote #4

Then it has something to do with the code that deals with the "amx_numb" command.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
padilha007
Senior Member
Join Date: Jul 2008
Old 08-14-2008 , 17:04   Re: read first line of .txt file
Reply With Quote #5

yeah, i use amx_numb fo this:

new coords[32]
get_cvar_string("amx_numb", coords, 31)
write_file( text , coords , 0);

I need get this number, using Emp` code, but i get just 1 number.
in file have: 100 100 100

but get just one, 100
padilha007 is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 08-15-2008 , 02:48   Re: read first line of .txt file
Reply With Quote #6

try
Code:
public pegar(id) {
new data[64]
new mapname[32] 
get_mapname(mapname,31) 

static text[128]; 
formatex( text, 127, "addons/amxmodx/configs/spawn/%s.txt", mapname );
fgets(fopen(text, "rt"), data, 63)
server_cmd("amx_numb ^"%s^"", data)
}
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
padilha007
Senior Member
Join Date: Jul 2008
Old 08-15-2008 , 18:29   Re: read first line of .txt file
Reply With Quote #7

work. tnx +karma
padilha007 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 03:06.


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