14.01.2012, 21:53
pawn Код:
CMD:vehname(playerid, params[]) {
if(playerVariables[playerid][pAdminLevel] >= 3) {
SendClientMessage(playerid, COLOR_TEAL, "--------------------------------------------------------------------------------------------------------------------------------");
SendClientMessage(playerid, COLOR_WHITE, "Vehicle Search:");
new
rcount,
string[128];
if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "No keyword specified.");
if(strlen(params) < 3) return SendClientMessage(playerid, COLOR_GREY, "Search keyword too short.");
for(new v; v < sizeof(VehicleNames); v++) {
if(strfind(VehicleNames[v], params, true) != -1) {
if(rcount == 0) format(string, sizeof(string), "%s (ID %d)", VehicleNames[v], v+400);
else format(string, sizeof(string), "%s | %s (ID %d)", string, VehicleNames[v], v+400);
rcount++;
}
}
if(rcount == 0) SendClientMessage(playerid, COLOR_GREY, "No results found.");
else if(strlen(string) >= 128) SendClientMessage(playerid, COLOR_GREY, "Too many results found.");
else SendClientMessage(playerid, COLOR_WHITE, string);
SendClientMessage(playerid, COLOR_TEAL, "--------------------------------------------------------------------------------------------------------------------------------");
}
return 1;
}