Wie bei tacho den fahrzeugnamen anzeigen?

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
  • hier wird es bei OnPalyerConnect erstellt:

    //Fahrzeugname
    Textdraw6[playerid] = CreatePlayerTextDraw(playerid, 140.000000, 357.000000, "Fahrzeug: Infernus");
    PlayerTextDrawBackgroundColor(playerid, Textdraw6 [playerid], 255);
    PlayerTextDrawFont(playerid ,Textdraw6 [playerid], 3);
    PlayerTextDrawLetterSize(playerid ,Textdraw6 [playerid], 0.250000, 1.000000);
    PlayerTextDrawColor(playerid ,Textdraw6 [playerid], -1);
    PlayerTextDrawSetOutline(playerid ,Textdraw6 [playerid], 0);
    PlayerTextDrawSetProportional(playerid ,Textdraw6 [playerid], 1);
    PlayerTextDrawSetShadow(playerid ,Textdraw6 [playerid], 1);
    PlayerTextDrawSetSelectable(playerid ,Textdraw6 [playerid], 0);

  • Okay.


    Nun als erstes fügst du das in deinen Script oben ein (Wenn du das oder so ähnlich noch nicht hast!):
    new PlayerVehicle[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 LS", "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"
    };


    Dann änderst du bei "OnPlayerStateChange" -> if(newstate == PLAYER_STATE_DRIVER) den String des Tachos:
    new string[32];//Sollte völlig reichen
    format(string,sizeof string,"Fahrzeug: %s",PlayerVehicle[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
    PlayerTextDrawSetString(playerid, Textdraw6[playerid], string);


    lg
    Deagle.

  • So das ist jz bei OnPlayerConnect:

    Textdraw6[playerid] = CreatePlayerTextDraw(playerid, 140.000000, 357.000000, "Fahrzeug: Infernus");
    PlayerTextDrawBackgroundColor(playerid, Textdraw6 [playerid], 255);
    PlayerTextDrawFont(playerid ,Textdraw6 [playerid], 3);
    PlayerTextDrawLetterSize(playerid ,Textdraw6 [playerid], 0.250000, 1.000000);
    PlayerTextDrawColor(playerid ,Textdraw6 [playerid], -1);
    PlayerTextDrawSetOutline(playerid ,Textdraw6 [playerid], 0);
    PlayerTextDrawSetProportional(playerid ,Textdraw6 [playerid], 1);
    PlayerTextDrawSetShadow(playerid ,Textdraw6 [playerid], 1);
    PlayerTextDrawSetSelectable(playerid ,Textdraw6 [playerid], 0);


    Und das bei OnPlayerStateChange:


    if(oldstate == PLAYER_STATE_DRIVER)
    {
    new string[32];//Sollte völlig reichen
    format(string,sizeof string,"Fahrzeug: %s",PlayerVehicle[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
    PlayerTextDrawSetString(playerid, Textdraw6[playerid], string);

    PlayerTextDrawHide(playerid, Textdraw6[playerid]);
    TextDrawHideForPlayer(playerid, Textdraw7[playerid]);
    PlayerTextDrawHide(playerid, Textdraw8[playerid]);
    PlayerTextDrawHide(playerid, Textdraw9[playerid]);
    PlayerTextDrawHide(playerid, Textdraw10[playerid]);
    PlayerTextDrawHide(playerid, Textdraw11[playerid]);
    PlayerTextDrawHide(playerid, Textdraw12[playerid]);
    PlayerTextDrawHide(playerid, Textdraw13[playerid]);
    }

  • Jz hab ich nen warning....


    Das bei OnPlayerConnect:



    Textdraw6[playerid] = CreatePlayerTextDraw(playerid, 140.000000, 357.000000, "Fahrzeug: string ");
    PlayerTextDrawBackgroundColor(playerid, Textdraw6 [playerid], 255);
    PlayerTextDrawFont(playerid ,Textdraw6 [playerid], 3);
    PlayerTextDrawLetterSize(playerid ,Textdraw6 [playerid], 0.250000, 1.000000);
    PlayerTextDrawColor(playerid ,Textdraw6 [playerid], -1);
    PlayerTextDrawSetOutline(playerid ,Textdraw6 [playerid], 0);
    PlayerTextDrawSetProportional(playerid ,Textdraw6 [playerid], 1);
    PlayerTextDrawSetShadow(playerid ,Textdraw6 [playerid], 1);
    PlayerTextDrawSetSelectable(playerid ,Textdraw6 [playerid], 0);


    Das bei OnPlayerStateChange



    new string[32];//Sollte völlig reichen
    format(string,sizeof string,"Fahrzeug: %s",PlayerVehicle[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
    PlayerTextDrawSetString(playerid, Textdraw6[playerid], string);
    PlayerTextDrawShow(playerid, Textdraw6[playerid]);
    TextDrawShowForPlayer(playerid, Textdraw7[playerid]);
    PlayerTextDrawShow(playerid, Textdraw8[playerid]);
    PlayerTextDrawShow(playerid, Textdraw9[playerid]);
    PlayerTextDrawShow(playerid, Textdraw10[playerid]);
    PlayerTextDrawShow(playerid, Textdraw11[playerid]);
    PlayerTextDrawShow(playerid, Textdraw12[playerid]);
    PlayerTextDrawShow(playerid, Textdraw13[playerid]);



    Das ist der warning:
    C:\Users\Spiele\Desktop\Server Ordner\Server Projekt\gamemodes\ServerProjekt.pwn(3232) : warning 219: local variable "string" shadows a variable at a preceding level

  • new string2[32];//Sollte völlig reichen
    format(string2,sizeof string2,"Fahrzeug: %s",PlayerVehicle[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
    PlayerTextDrawSetString(playerid, Textdraw6[playerid], string2);


    Oder einfach
    new string2[32];
    löschen.