Hmmm...You could use Parse and Array. Are you getting this text from a text file? So instead of Parse use the new one:
Code:
strtok(const text[], Left[], leftLen, Right[], rightLen, token=' ', trimSpaces=0)
I'll assume that strtok will return the length of the string taken....
So I would look at it like this:
Code:
//Global
new MyString[84] = "de_dust de_aztec de_nuke de_inferno"
new MyArray = new_list_string()
public plugin_cfg()
{
new mapName[32]
while((strtok(MyString, mapName, 31, MyString, 83, ' ', 1)) > 0)
{
list_push_string(MyArray, mapName)
}
}
....
Code
....
public plugin_end()
{
list_delete_string(MyArray)
}
....
Code
....
public MapChange(param[])
{
new positonIwant = str_to_num(param[0])
new mapName[32]
list_get_string ( MyArray, positonIwant, mapName, 31)
server_cmd("changelevel %s", mapName)
}
Well thats about it. Now thats about as dynamic as you can get it. And there are probably some errors in it. But its an idea.
Cheers!
__________________