Код:
if (strcmp("/vehicle", cmd, true, 10) == 0 || strcmp("/v", cmd, true, 10) == 0)
{
new carfound, Float:X, Float:Y, Float:Z, Float:A, vid;
tmp = strtok(cmdtext, index);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /vehicle <VehicleName>");
for(new i; i<212; i++)
{
if (strfind(VehicleNames[i], tmp, true ) != -1)
{
carfound = 1;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
vid = CreateVehicle(i+400, X, Y, Z, A, -1, -1, 600000);
PutPlayerInVehicle(playerid, vid, 0);
new string[128];
format(string, sizeof(string), "* You spawned a new %s...", VehicleNames[i]);
SendClientMessage(playerid, COLOR_YELLOW, string);
------->break;// COMMMMMMMMENT
}
}
if(carfound == 0)
{
new str[128];
format(str, sizeof(str), "* Sorry, no results were found for the vehicle name: \"%s\"", tmp);
SendClientMessage(playerid, COLOR_YELLOW, str);
}
return 1;
}
COMMMMMMENT: If you add this line it will spawn only one vehicle ( the first vehicle that it finds )