Raised This Month: $51 Target: $400
 12% 

Reading from file random


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CsIosefin
Senior Member
Join Date: Aug 2009
Old 09-30-2012 , 20:38   Reading from file random
Reply With Quote #1

Do not know much about working with files.
It is possible random reading?
Some of the code:
Code:
while((line = read_file(configsDir, line, textline, 31, len)))
{
    trim(textline);
     format(text, MAX_TEXTLEN, "%s %s^n", text, textline);
}
And here is displayed:
Code:
console_print(id, "%s", text);
It reads from maps.ini:
Code:
de_dust
cs_siege
de_dust2
I do not display on all 3 but only one.

Last edited by CsIosefin; 09-30-2012 at 20:38.
CsIosefin is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-30-2012 , 20:56   Re: Reading from file random
Reply With Quote #2

For reading from a file, look at mapchooser.sma. What do you mean by random? What are you trying to do?
__________________
fysiks is offline
CsIosefin
Senior Member
Join Date: Aug 2009
Old 09-30-2012 , 21:22   Re: Reading from file random
Reply With Quote #3

Mapchooser's selection of five maps (or as we set new) but I would like to simply select only one folder (only one row and have that row selected map). I select a map to set a cvar to paper.
CsIosefin is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-30-2012 , 21:29   Re: Reading from file random
Reply With Quote #4

Wow, that was horrible, convoluted English. I'm guessing a translator would be better than that.

If you are trying to simply choose a random map from the file and set it as the next map then it is quite simple. You do what mapchooser already does and you choose a random map from the array and set it to the amx_nextmap cvar.

PHP Code:
new szNextMap[32]
ArrayGetString(g_mapNamerandom(ArraySize(g_mapName)), szNextMapcharsmax(szNextMap))
set_cvar_string("amx_nextmap"szNextMap
__________________
fysiks 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 16:16.


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