if(strcmp(cmd, "/veh", true) == 0) { if(IsPlayerConnected(playerid)) { if (PlayerInfo[playerid][pAdmin] < 6) { SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]"); return 1; } new car; car = strval(tmp); if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_GREY, " Vehicle Number can't be below 400 or above 611 !"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]"); return 1; } new color1; color1 = strval(tmp); if(color1 < -1 || color1 > 126) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 126 !"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]"); return 1; } new color2; color2 = strval(tmp); if(color2 < -1 || color2 > 126) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 126 !"); return 1; } new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid, X,Y,Z); new carid = CreateVehicle(car, X,Y+5,Z+1, 0.0, color1, color2, 60000); CreatedCars[CreatedCar] = carid; CreatedCar ++; LinkVehicleToInterior(carid, GetPlayerInterior(playerid)); SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid)); format(string, sizeof(string), "** Vehicle %d spawned.", carid); SendClientMessage(playerid, COLOR_GREY, string); new y, m, d; new h,mi,s; getdate(y,m,d); gettime(h,mi,s); format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Spawned the Car [%d] (Color 1: %d | Color 2: %d) At His Position.",d,m,y,h,mi,s,sendername,carid,color1,color2); AdminLog(string); } return 1; }
Originally Posted by Babul
have a look in the LAdmin filterscript, it has a /car <ID/Name> command
http://forum.sa-mp.com/index.php?topic=36990.0 |
new const VehicleNames[][] =
{
"Landstalker",
"Bravura",
"Buffalo",
"Linerunner",
"Perenniel",
"Sentinel",
"Dumper",
"Firetruck",
"Trashmaster",
"Stretch",
"Manana",
"Infernus",
"Voodoo",
"Pony",
"Mule",
"Cheetah",
"Ambulance",
"Leviathan",
"Moonbeam",
"Esperanto",
"Taxi",
"Washington",
"Bobcat",
"Mr. Whoopee",
"BF Injection",
"Hunter",
"Premier",
"Enforcer",
"Securicar",
"Banshee",
"Predator",
"Bus",
"Rhino",
"Barracks",
"Hotknife",
"Article Trailer",
"Previon",
"Coach",
"Cabbie",
"Stallion",
"Rumpo",
"RC Bandit",
"Romero",
"Packer",
"Monster",
"Admiral",
"Squallo",
"Seasparrow",
"Pizzaboy",
"Tram",
"Article Trailer 2",
"Turismo",
"Speeder",
"Reefer",
"Tropic",
"Flatbed",
"Yankee",
"Caddy",
"Solair",
"Berkley's RC Van",
"Skimmer",
"PCJ-600",
"Faggio",
"Freeway",
"RC Baron",
"RC Raider",
"Glendale",
"Oceanic",
"Sanchez",
"Sparrow",
"Patriot",
"Quad",
"Coastguard",
"Dinghy",
"Hermes",
"Sabre",
"Rustler",
"ZR-350",
"Walton",
"Regina",
"Comet",
"BMX",
"Burrito",
"Camper",
"Marquis",
"Baggage",
"Dozer",
"Maverick",
"SAN News Maverick",
"Rancher",
"FBI Rancher",
"Virgo",
"Greenwood",
"Jetmax",
"Hotring Racer",
"Sandking",
"Blista Compact",
"Police Maverick",
"Boxville",
"Benson",
"Mesa",
"RC Goblin",
"Hotring Racer 2",
"Hotring Racer 3",
"Bloodring Banger",
"Rancher 2",
"Super GT",
"Elegant",
"Journey",
"Bike",
"Mountain Bike",
"Beagle",
"Cropduster",
"Stuntplane",
"Tanker",
"Roadtrain",
"Nebula",
"Majestic",
"Buccaneer",
"Shamal",
"Hydra",
"FCR-900",
"NRG-500",
"HPV1000",
"Cement Truck",
"Towtruck",
"Fortune",
"Cadrona",
"FBI Truck",
"Willard",
"Forklift",
"Tractor",
"Combine Harvester",
"Feltzer",
"Remington",
"Slamvan",
"Blade",
"Freight",
"Brownstreak",
"Vortex",
"Vincent",
"Bullet",
"Clover",
"Sadler",
"Firetruck LA",
"Hustler",
"Intruder",
"Primo",
"Cargobob",
"Tampa",
"Sunrise",
"Merit",
"Utility Van",
"Nevada",
"Yosemite",
"Windsor",
"Monster A",
"Monster B",
"Uranus",
"Jester",
"Sultan",
"Stratum",
"Elegy",
"Raindance",
"RC Tiger",
"Flash",
"Tahoma",
"Savanna",
"Bandito",
"Freight Flat Trailer",
"Streak Trailer",
"Kart",
"Mower",
"Dune",
"Sweeper",
"Broadway",
"Tornado",
"AT400",
"DFT-30",
"Huntley",
"Stafford",
"BF-400",
"Newsvan",
"Tug",
"Petrol Trailer",
"Emperor",
"Wayfarer",
"Euros",
"Hotdog",
"Club",
"Freight Box Trailer",
"Article Trailer 3",
"Andromada",
"Dodo",
"RC Cam",
"Launch",
"Police Car (LSPD)",
"Police Car (SFPD)",
"Police Car (LVPD)",
"Police Ranger",
"Picador",
"S.W.A.T.",
"Alpha",
"Phoenix",
"Glendale Shit",
"Sadler Shit",
"Baggage Trailer A",
"Baggage Trailer B",
"Tug Stairs Trailer",
"Boxville 2",
"Farm Trailer",
"Utility Trailer"
};
stock bool:IsNumericChar(character) return character > 47 && character < 58;
stock GetCharsCount(const string[], ...)
{
new Count, num = numargs();
for(new n = 1; n<num; n++) for(new i; i<strlen(string); i++) if(getarg(n, 0) && string[i] == getarg(n, 0)) Count++;
return Count;
}
stock GetNumericCharsCount(const string[]) return GetCharsCount(string, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57);
stock bool:IsNumeric(const string[]) return GetNumericCharsCount(string) == strlen(string);
stock bool:GetNumericPartOfString(const string[], output[], &index)
{
new lenght = strlen(string);
if(!lenght || !GetNumericCharsCount(string)) return false;
while(index < lenght && !IsNumericChar(string[index])) index++;
new offset = index;
while(index < lenght && IsNumericChar(string[index])) output[index - offset] = string[index], index++;
return true;
}
stock GetVehicleModelFromName(const name[])
{
if(IsNumeric(name)) return strval(name);
for(new i; i<sizeof(VehicleNames); i++) if(strfind(VehicleNames[i], name, true) != -1) return i + 400;
new output[5], index;
if(GetNumericPartOfString(name, output, index) && strval(output) < 612 && strval(output) > 399) return strval(output);
return 0;
}
new Model = GetVehicleModelFromName(tmp);
Originally Posted by ¤Adas¤
Here is the stuff needed to do that. Just copy it into your include or at the top of your script.
[pawn] Just put this into the script: pawn Код:
![]() |
if(strcmp(cmd, "/veh", true) == 0)
  {
    if (PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command!");
      tmp = strtok(cmdtext, idx);
      if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]");
      new car = GetVehicleModelFromName(tmp);
      tmp = strtok(cmdtext, idx);
      if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]");
      new color1;
      color1 = strval(tmp);
      if(color1 < -1 || color1 > 126) return SendClientMessage(playerid, COLOR_GREY, "  Color Number can't be below 0 or above 126 !");
      tmp = strtok(cmdtext, idx);
      if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]");
      new color2;
      color2 = strval(tmp);
      if(color2 < -1 || color2 > 126) return SendClientMessage(playerid, COLOR_GREY, "  Color Number can't be below 0 or above 126 !");
      new Float:X,Float:Y,Float:Z;
      GetPlayerPos(playerid, X,Y,Z);
      new carid = CreateVehicle(car, X,Y+5,Z+1, 0.0, color1, color2, 60000);
      CreatedCars[CreatedCar] = carid;
      CreatedCar ++;
      LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
      SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid));
      format(string, sizeof(string), "** Vehicle %d spawned.", carid);
      SendClientMessage(playerid, COLOR_GREY, string);
      new y, m, d;
      new h,mi,s;
      getdate(y,m,d);
      gettime(h,mi,s);
      format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Spawned the Car [%d] (Color 1: %d | Color 2: %d) At His Position.",d,m,y,h,mi,s,sendername,carid,color1,color2);
      AdminLog(string);
    return 1;
  }
Originally Posted by ¤Adas¤
pawn Код:
|
C:\Users\Alen\Desktop\PROGRAMING\Serious-Gaming RolePlay\gamemodes\lsrp.pwn(921) : error 025: function heading differs from prototype
C:\Users\Alen\Desktop\PROGRAMING\Serious-Gaming RolePlay\gamemodes\lsrp.pwn(921) : error 021: symbol already defined: "IsNumeric"
stock bool:IsNumeric(const string[]) return GetNumericCharsCount(string) == strlen(string);