new ArrayString[][] = {
/*
some string lines
*/
{"some string"},
/* something like #define ARRAY_INDEX = */{"my string"},//Index of this is 1 (but i don't now it)
{"string continue"},
/*
some string lines
*/
};
public OnFilterScriptInit()
{
printf("index of array ArrayString where text is 'my string' = %d",ARRAY_INDEX);//index is 1
return 1;
}
|
Why? If you need static access to it, put it in a separate variable.
|
new ListOfUpdates[][] = {
/*
add new update on top
*/
"Update 3: Smaller update",
/*
some updates
*/
"Update 2: Very big and interesting update",
/*
some updates
*/
"Update 1: Add something"
/*
1000 old updates
*/
};
cmd:updates(playerid,params[])
{
//show first 10 lines (new updates)
}
cmd:bigupdate(playerid,params[])
{
//show 10 lines of update 2 (i don't now the index of 'Update 2:...')
}
cmd:updates(playerid,params[])
{
new string[1024];
for(new i;i<LINES_OF_UPDATES;i++)
{
strcat(string,ListOfUpdates[i]);
strcat(string,"\n");
}
ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"Updates",string,"Close","");
return 1;
}
new Settings[][] = {
"Gravity",
"Max money in pocket",
/*
i want add:
"Max weapon ammo"
*/
"Time",
"Weather",//index is 4. Bud when i add line index is will be 5
};
new SettingValue[sizeof(Settings)];//integer value for setting (for Weather for example id 16 (rain))
prikaz:getsettime(playerid,params[])
{
new index = ??;
new string[144];
format(string,sizeof(string),"%s is set to %d",Settings[index],SettingValue[index]);
SendClientMessage(playerid,0xFFFFFFFF,string);
return 1;
}