CMD:car(playerid, params[]) { new carName[100]; new message[128]; if(sscanf(params, "s[100]", carName)) return SendClientMessage(playerid, COL_RED, "[USAGE]: /car [vehiclename]."); if (ReturnVehicleID(carName) == INVALID_VEHICLE_ID) return SendClientMessage(playerid, COL_RED, "[SERVER]: Vehicle name/id not found."); if (PlayerInfo[playerid][pRights] < 3) return SendClientMessage(playerid, COL_RED, "[SERVER]: You don't have the rights to use this command."); new Float:pPos[4], vid; GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]); GetPlayerFacingAngle(playerid, pPos[3]); vid = CreateVehicle(ReturnVehicleID(carName), pPos[0], pPos[1], pPos[2] + 1, pPos[3], 0, 1, 60); PutPlayerInVehicle(playerid, vid, 0); format (message, 128, "You have spawned a %s.", GetVehicleNames(carName)); SendClientMessage(playerid, COL_GREEN, message); return 1; }
new VehicleNames[][] =
{
"Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel",
"Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
"Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
"Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection",
"Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus",
"Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie",
"Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral",
"Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "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", "News Chopper",
"Rancher", "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking",
"Blista Compact", "Police Maverick", "Boxville", "Benson", "Mesa", "RC Goblin",
"Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher", "Super GT",
"Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "Stunt",
"Tanker", "Roadtrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra",
"FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune",
"Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer",
"Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent",
"Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder", "Primo",
"Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite",
"Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratium",
"Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
"Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper",
"Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400",
"News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
"Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car",
"Police Car", "Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
"Phoenix", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs", "Boxville",
"Tiller", "Utility Trailer"
};
GetVehicleNames(vehicleid)
{
new string[128];
format(string, sizeof(string), "%s",VehicleNames[GetVehicleModel(vehicleid) - 400]);
return string;
}
Your GetVehicleNames feature probably doesn't work like you want it to.
To get vehicle's names you need something like this: pawn Код:
|
new VehicleNames[212][] =
{
{"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"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"},{"Squalo"},{"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"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},{"Jetmax"},{"Hotring"},
{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},{"Mesa"},{"RC Goblin"},
{"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},{"Super GT"},{"Elegant"},
{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},{"Tanker"},{"Roadtrain"},
{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},{"NRG-500"},{"HPV1000"},
{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},{"Willard"},{"Forklift"},
{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},{"Blade"},{"Freight"},{"Streak"},
{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},{"Firetruck LA"},{"Hustler"},{"Intruder"},
{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},{"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},
{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},{"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},
{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},{"Bandito"},{"Freight Flat"},{"Streak Carriage"},
{"Kart"},{"Mower"},{"Dunerider"},{"Sweeper"},{"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},
{"Stafford"},{"BF-400"},{"Newsvan"},{"Tug"},{"Article Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Mobile Hotdog"},
{"Club"},{"Freight Carriage"},{"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},
{"Police Car (SFPD)"},{"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T Van"},{"Alpha"},
{"Phoenix"},{"Glendale"},{"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},
{"Boxville"},{"Farm Plow"},{"Utility Trailer"}
};
stock GetVehicleNames(vehicleid)
{
new GVFNstring[56];
format(GVFNstring, sizeof(GVFNstring), VehicleNames[GetVehicleModel(vehicleid)-400]);
return GVFNstring;
}
format(GVFNstring, sizeof(GVFNstring), VehicleNames[GetVehicleModel(vehicleid)-400]);
format(GVFNstring, sizeof(GVFNstring), "%s", VehicleNames[GetVehicleModel(vehicleid)-400]);
format (message, 128, "You have spawned a %s.", GetVehicleNames(carName));
format (message, 128, "You have spawned a %s.", GetVehicleNames(ReturnVehicleID(carName)));
Try to replace this
pawn Код:
pawn Код:
|
Change this:
PHP код:
PHP код:
|
ReturnVehicleID(vName[])
{
for(new x; x != 211; x++) if(strfind(VehicleNames[x], vName, true) != -1) return x + 400;
return INVALID_VEHICLE_ID;
}
CMD:car(playerid, params[])
{
if(PlayerInfo[playerid][pRights] < 3) SendClientMessage(playerid, COL_RED, "[SERVER]: You don't have the rights to use this command.");
else if(isnull(params)) SendClientMessage(playerid, COL_RED, "[USAGE]: /car [vehicle name / model].");
else{
new Model = ReturnVehicleID(params);
if(Model == INVALID_VEHICLE_ID)
{
if(strlen(params) > 8) params[8] = EOS;
Model = strval(params);
if(!(400 <= Model <= 611))
return SendClientMessage(playerid, COL_RED, "[SERVER]: Vehicle name/id not found.");
}
new message[75], Float:pPos[4], vid;
GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
GetPlayerFacingAngle(playerid, pPos[3]);
vid = CreateVehicle(Model, pPos[0], pPos[1], pPos[2] + 1, pPos[3], 0, 1, 60);
PutPlayerInVehicle(playerid, vid, 0);
format(message, sizeof(message), "You have spawned a %s.", GetVehicleNames(vid));
SendClientMessage(playerid, COL_GREEN, message);
}
return 1;
}
Change this:
PHP код:
PHP код:
|
pawn Код:
|