Brauche hilfe mit dem errors

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • (18443) : error 017: undefined symbol "VehicleName"
    (18443) : warning 215: expression has no effect
    (18443) : error 001: expected token: ";", but found "]"
    (18443) : error 029: invalid expression, assumed zero
    (18443) : fatal error 107: too many error messages on one line


    public VehStateCheck()
    {
    foreach (Character,i)
    {
    if(GetPlayerState(i) == PLAYER_STATE_DRIVER && !IsANoTachoVehicle(GetPlayerVehicleID(i)))


    {
    new Float:health,vehicleid = GetPlayerVehicleID(i),string[256],Float:value,Float:distance,Float:x,Float:y,Float:z;
    GetPlayerPos(i, x, y, z);
    distance = floatsqroot(floatpower(floatabs(floatsub(x,PCarPos[i][PCarX])),2)+floatpower(floatabs(floatsub(y,PCarPos[i][PCarY])),2)+floatpower(floatabs(floatsub(z,PCarPos[i][PCarZ])),2));
    value = floatround(distance * 11000);
    GetVehicleHealth(vehicleid,health);
    if (health >= 900 && health <= 1000)
    {
    format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~w~%d~g~ KM/H~n~~w~%d ~b~/~w~ %d~r~ Benzin~n~~g~~h~%s",floatround(value/1400),Gas[vehicleid],GetGasMax(GetVehicleModel(vehicleid)),VehicleName[GetVehicleModel(vehicleid)-400]);
    GameTextForPlayer(i,string,850,3);
    }
    else if (health >= 600 && health < 900)
    {
    format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~w~%d~g~ KM/H~n~~w~%d ~b~/~w~ %d~r~ Benzin~n~~g~%s",floatround(value/1400),Gas[vehicleid],GetGasMax(GetVehicleModel(vehicleid)),VehicleName[GetVehicleModel(vehicleid)-400]);
    GameTextForPlayer(i,string,850,3);
    }
    else if (health >= 380 && health < 600)
    {
    format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~w~%d~g~ KM/H~n~~w~%d ~b~/~w~ %d~r~ Benzin~n~~y~%s",floatround(value/1400),Gas[vehicleid],GetGasMax(GetVehicleModel(vehicleid)),VehicleName[GetVehicleModel(vehicleid)-400]);
    GameTextForPlayer(i,string,850,3);
    }
    else if (health >= 0 && health < 380)
    {
    format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~w~%d~g~ KM/H~n~~w~%d ~b~/~w~ %d~r~ Benzin~n~~r~%s",floatround(value/1400),Gas[vehicleid],GetGasMax(GetVehicleModel(vehicleid)),VehicleName[GetVehicleModel(vehicleid)-400]);
    GameTextForPlayer(i,string,850,3);
    }
    PCarPos[i][PCarX] = x;
    PCarPos[i][PCarY] = y;
    PCarPos[i][PCarZ] = z;
    }


    }
    return 1;
    }

  • warum ein array hm?


    schauen wir uns mal das genauer an.



    VehicleName[GetVehicleModel(vehicleid)-400]


    zwei Klammern [ ]
    man entferne den inhalt


    VehicleName[]


    es sieht aus wie ein eindimensonales array.(ist es auch)


    gehen wir mal zurück zum Uhrsprung wie es sein sollte.


    new VehicleName[];


    VehicleName == Fahrzeugnamen

    new VehicleName []={
    "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","Glendale Shit","Sadler Shit","Luggage","Luggage","Stairs","Boxville",
    "Tiller","Utility Trailer"
    };