How to? I need a example.
Search the forum, there's plenty of information.
http://forum.vc-mp.org/?topic=180.msg921#msg921
Also, you can't select random stuff from tables because that's not how tables work.
Untested
RandomFromTable(tbl)
{
local tarr;
foreach (item in tbl) tarr.push(item);
return tarr[Random(0, tarr.len() - 1)];
}
Use this: http://forum.vc-mp.org/?topic=246.0
No need to create a copy of the table just to select a random value from it:
::srand((::GetTickCount() % ::time()) / 3);
RandomFromTable(tbl)
{
local ridx = ::rand() % tbl.len(), idx = 0;
foreach (k, v in tbl)
{
if (idx == ridx)
{
return v;
}
++idx;
}
}