Mm Solo define lo que te tira error
pawn Код:
GetVehicleModelIDFromName(vname[])
{
for(new i = 0; i < 211; i++)
{
if(strfind(aVehicleNames[i], vname, true) != -1)
return i + 400;
}
return -1;
}
Y si kieres todo el comando
pawn Код:
if(strcmp(cmd, "/v", true, 10) == 0)//Comando!
{
new String[200];
new tmp[256];
new Float:x, Float:y, Float:z;
new v[MAX_PLAYERS];
DestroyVehicle(v[playerid]);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, BLANCO, "Use /v [Nombre/Modelo]");
new vehicle = GetVehicleModelIDFromName(tmp);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, COLOR_ROJO, "Nombre invalido.");
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
DestroyVehicle(v[playerid]);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
if(strcmp(cmd, "/v", true, 10) == 0)
DestroyVehicle(v[playerid]);
v[playerid] = CreateVehicle(vehicle, x, y, z, a, -1, -1, 60);
LinkVehicleToInterior(v[playerid], GetPlayerInterior(playerid));
PutPlayerInVehicle(playerid,v[playerid],0);
format(String, sizeof(String), "Toma tu %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid, COLOR_VERDE, String);
return 1;
}