GetVehicleName geht nicht

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
  • Hallo, ich habe gerade etwas gescriptet. Und zwar eine Fahrzeug names anzeige. Jedoch funktioniert die nichtso ganz. Wenn ich in ein Auto einsteig und dann den Motor anmache dann müsste da zb Sultan stehen, aber da steht einfach nichts. An was könnte es liegen?


    Hier mal der Code:


    getVehicleName(v_model)
    {
    new carNames[212][] = {
    "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 1", "Previon", "Coach", "Cabbie", "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral", "Squalo",
    "Seasparrow", "Pizzaboy", "Tram", "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", "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 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", "Dune", "Sweeper", "Broadway",
    "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400", "News Van", "Tug", "Trailer 3", "Emperor", "Wayfarer", "Euros", "Hotdog",
    "Club", "Freight Carriage", "Trailer 4", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car (LSPD)", "Police Car (SFPD)",
    "Police Car (LVPD)", "Police Ranger", "Picador", "S.W.A.T", "Alpha", "Phoenix", "Glendale", "Sadler", "Luggage Trailer A",
    "Luggage Trailer B", "Stairs", "Boxville", "Tiller", "Utility Trailer" };


    new string[128];
    format(string,sizeof(string),"%s",carNames[v_model-400]);
    return string;
    }


    public sekunde()
    {
    new string[64],string2[64];
    for(new i=0; i<MAX_PLAYERS; i++)
    {
    if(!IsPlayerConnected(i))continue;
    if(!IsPlayerInAnyVehicle(i))continue;
    format(string,sizeof(string),"%ikm/h",getPlayerSpeed(i));
    TextDrawSetString(TachoTD[1],string);
    new vID = GetPlayerVehicleID(i);
    format(string,sizeof(string),"%s",getVehicleName(GetVehicleModel(vID)));
    TextDrawSetString(TachoTD[6],string2);
    }
    return 1;
    }


    Danke im VOrraus


    MfG Exon

  • Hier, schreib mal alles so:


    static const carNames[212][20 char] = {
    !"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 1", !"Previon", !"Coach", !"Cabbie", !"Stallion", !"Rumpo", !"RC Bandit", !"Romero", !"Packer", !"Monster", !"Admiral", !"Squalo",
    !"Seasparrow", !"Pizzaboy", !"Tram", !"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", !"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 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", !"Dune", !"Sweeper", !"Broadway",
    !"Tornado", !"AT-400", !"DFT-30", !"Huntley", !"Stafford", !"BF-400", !"News Van", !"Tug", !"Trailer 3", !"Emperor", !"Wayfarer", !"Euros", !"Hotdog",
    !"Club", !"Freight Carriage", !"Trailer 4", !"Andromada", !"Dodo", !"RC Cam", !"Launch", !"Police Car (LSPD)", !"Police Car (SFPD)",
    !"Police Car (LVPD)", !"Police Ranger", !"Picador", !"S.W.A.T", !"Alpha", !"Phoenix", !"Glendale", !"Sadler", !"Luggage Trailer A",
    !"Luggage Trailer B", !"Stairs", !"Boxville", !"Tiller", !"Utility Trailer"
    };


    stock getVehicleName(model) {
    static buffer[32];
    return strunpack(buffer,carNames[(model)-400],sizeof buffer),buffer;
    }


    public sekunde() {
    new string[64];
    for(new i; i<MAX_PLAYERS; i++) {
    if(!IsPlayerConnected(i) || !IsPlayerInAnyVehicle(i))continue;
    format(string,sizeof(string),"%ikm/h",getPlayerSpeed(i));
    TextDrawSetString(TachoTD[1],string);
    TextDrawSetString(TachoTD[6],getVehicleName(GetVehicleModel(GetPlayerVehicleID(i))));
    }
    return 1;
    }


    Damit spart du jede Menge speicher ;)


    mfg. :thumbup:

    ast2ufdyxkb1.png


    Leute, lernt scripten und versucht mal lieber etwas selber zu schreiben, als es aus einem GF zu kopieren. :S

    Einmal editiert, zuletzt von Kaliber ()