Ok Sry, habe die Definition CarNames falsch kopiert, hier das richtige:
new CarName[][] =
{
"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", "Boxvillde", "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", "Stratum",
"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", "2. Gebrauchtwagen", "1. Gebrauchtwagen", "Luggage", "Luggage", "Stairs", "Boxville",
"Tiller", "Utility Trailer"
};
dcmd_spawn(playerid, params[])
{
if (!IsPlayerAdmin(playerid)) return SendClientMessage (playerid, 0xFFFFFFFF, " **Du bist kein Admin!"); //Abfrage ob Spieler RCON-Admin ist
if (!strlen(params)) return SendClientMessage(playerid, 0xFFFFFFFF, " **/spawn <FahrzeugID>"); //Ob Spieler bei params einen Wert oder Text angegeben hat!
new cid = -1, nameid = 0, Float:player_pos[4];
GetPlayerPos (playerid, player_pos[0], player_pos[1], player_pos[2]);
GetPlayerFacingAngle (playerid, player_pos[3]);
floatadd(player_pos[0], 5.0);
floatadd(player_pos[2], 1.0);
floatadd(player_pos[3], 90.0);
if(!IsNumeric(params))
{
for(; nameid < sizeof(CarName); nameid++)
{
new nameid2[100], i = sizeof(CarName), j = strcmp(params, CarName[nameid], true);
format(nameid2,sizeof(nameid2), "nameid=%i, i=%i, j=%i",nameid, i, j);
print(nameid2);
if(strcmp(params, CarName[nameid], true) == 0)
{
cid = (nameid+400);
break;
}
}
if(cid == -1) return SendClientMessage(playerid, 0xFFFFFFFF, "Ungültiger Fahrzeugname!");
}
else if (IsNumeric(params)) //Ob das eingegebene einer Zahl entspricht
{
if(strval(params) < 400 || strval(params) > 611) return SendClientMessage(playerid, 0xFFFFFFFF, "FahrzeugID nicht kleiner als 400 oder größer als 611!"); //Die Abfrage sollte logisch sein
cid = strval(params); //Eingegebene Model-ID wird in die Variable cid gespeichert
}
gDeleteCreatedVehicles[gCountDeleteCreatedVehicles] = CreateVehicle(cid,player_pos[0],player_pos[1],player_pos[2],player_pos[3],-1,-1,-1); //Erstellt das Fahrzeug
gCountDeleteCreatedVehicles++; //Addiert den Zähler um 1 mehr
return 1;
}