[SOLVED] /veh command with vehiclename or vehid in dcmd (from strcmp to dcmd)
#5

Oh, I thought you meant using the ID. Here is the version using the name
pawn Code:
dcmd_veh(playerid,params[])
{
  new vehid[56] = GetVehicleModelIDFromName(params);
  if(sscanf(params,"s",vehid)) return SendClientMessage(playerid,GREEN,"[USAGE] /veh [Vehicle Name]");
  else
  {
    new Float:x, Float:y, Float:z, Float:a;
    GetPlayerFacingAngle(playerid, a);
    GetPlayerPos(playerid, x, y, z);
    if(IsPlayerInAnyVehicle(playerid) == 1) {
      GetXYInFrontOfPlayer(playerid, x, y, 8);
    }
    else {
      GetXYInFrontOfPlayer(playerid, x, y, 5);
    }
    new i = GetPlayerInterior(playerid);
    new v = CreateVehicle(vehid, x, y, z, a+90, -1, -1, 0);
    LinkVehicleToInterior(v, i);
    new string[100];
    format(string, sizeof(string), "Car with id %s has been spawned", aVehicleNames[vehid - 400]);
    SendClientMessage(playerid, GREEN, string);
  }
  return 1;
}
All you really needed is to change it to a string.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)