SA-MP Forums Archive
help: multiple results for vehicle found - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: help: multiple results for vehicle found (/showthread.php?tid=378630)



help: multiple results for vehicle found - NewbieScripter - 18.09.2012

hello,

my question is... how to make a multiple results for vehicle found ?

example when i type /v <vehicle name>

example /v mave

and send the messages

multiple results for mave were found (2 matches)

Maverick (Model ID:487)

Police-Maverick (Model ID:497)

ecc... for all vehicles


Re: help: multiple results for vehicle found - Jefff - 18.09.2012

pawn Код:
new Model[MAX_MATCHES],cnt;

for(new d; d < sizeof(VehicleNames); d++)
    if(strfind(VehicleNames[d],cmdtext,true) != -1)
    {
        Model[cnt++] = (d + 400);
    }
   
if(cnt == 0) // No results
else{

    // multiple results for mave were found (%d matches),cnt

    for(new v; v < cnt; v++)
    {
        // Maverick (Model ID:487) // VehicleNames[Model[v]-400],Model[v]

        // Police-Maverick (Model ID:497) // VehicleNames[Model[v]-400],Model[v]
    }
}