19.06.2014, 18:00
For all those who asked, here it is. This allows you to /search [query] ingame and it'll return objects which you can spawn. It's basically an ingame search engine like gta-sa-mp.de and/or MTA.
Include libraries you'll need:
- mSelection (By d0): thread
- oarray (By Pottus): pastebin
- zcmd (By Zeex): thread
Note (installation/proper mSelection config):
In order for the mSelection menu to show pages, you need to change the "mS_CUSTOM_MAX_ITEMS" value to MAX_OBJECTS. Not doing this will return constant console warnings about an invalid array size (seeing our object list exceeds the default one) and will only show you one page with 19 objects.
Credits: Pottus, TakeiT, Memoryz
Ingame picture:
Include libraries you'll need:
- mSelection (By d0): thread
- oarray (By Pottus): pastebin
- zcmd (By Zeex): thread
Note (installation/proper mSelection config):
In order for the mSelection menu to show pages, you need to change the "mS_CUSTOM_MAX_ITEMS" value to MAX_OBJECTS. Not doing this will return constant console warnings about an invalid array size (seeing our object list exceeds the default one) and will only show you one page with 19 objects.
Credits: Pottus, TakeiT, Memoryz
Ingame picture:
pawn Код:
#include <a_samp>
#include <mSelection>
#include <oarray>
#include <zcmd>
#define SEARCH_MENU 1
CMD:search(playerid, params[])
{
new items, arrSearch[125];
if (isnull(params)) return SendClientMessage(playerid, -1, "/search [params]");
for(new i; i < sizeof(ObjectList) && items < sizeof(arrSearch); i ++)
{
if(strfind(ObjectList[i][oName], params, true) != -1)
{
arrSearch[items ++] = ObjectList[i][oID];
}
}
ShowModelSelectionMenuEx(playerid, arrSearch, items, "Search Results", SEARCH_MENU, 0.0, 0.0, 90.0);
return true;
}
public OnPlayerModelSelectionEx(playerid, response, extraid, modelid)
{
if(extraid == SEARCH_MENU)
{
if(response)
{
new Float:X, Float:Y, Float:Z, sel;
GetPlayerPos(playerid, X, Y, Z);
sel = CreateObject(modelid, X +1, Y, Z, 0.00, 0.00, 0.00);
EditObject(playerid, sel);
return true;
}
}
return true;
}