if (strcmp(cmd, "/gotocar", true) == 0 && GetPlayerLevel(playerid) >= CAN_TELE)
{
tmp = strtok(cmdtext, idx);
if (!strlen(tmp))
{
SendErrMsg(playerid,"Usage: /gotocar [vehicle name] (Works with a part like Inf for Infernus)");
return 1;
}
new inuse=0;
for (new i=1; i <= TotCars; i++)
{
if (strfind(GetVehicleName(i),tmp) != -1 || strfind(GetVehicleName(i),tmp, true) == 0)
{
if (IsAnyPlayerInVehicle(i) == 1)
{
inuse = 1;
} else
{
new Float:X, Float:Y, Float:Z;
GetVehiclePos(i, X, Y, Z);
SetPlayerPos(playerid, X, Y, Z + 4);
SendMsg(playerid, "Have fun with it!");
return 1;
}
}
}
if (inuse == 1)
{
SendErrMsg(playerid,"A car was found, but in use.");
return 1;
} else
{
SendErrMsg(playerid,"No car was found.");
return 1;
}
return 1;
}