SA-MP Forums Archive
Any faster searching method? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Any faster searching method? (/showthread.php?tid=257873)



Any faster searching method? - leong124 - 28.05.2011

Hello,
I made a /v command that can spawn vehicles by entering the vehicle model ID/name.
However I find that searching for the vehicle name is so slow that it freezes my server for a while.
Code for searching in my command currently:
pawn Код:
for(new i = 0;i < sizeof(vehiclename);i++)//212 vehicle names
    if(strfind(vehiclename[i],params,true) != -1) break;
I've benchmarked that code and it runs at around 1 time/ms!

Therefore I'd like to know if there's any faster method.


Re: Any faster searching method? - KaleOtter - 28.05.2011

I don't think so, you can use a vehicle dialog or only accept full names instead of part names.
And I never noticed this function is slow. So might it got another reason.