Speedo meter bitte hilfe!

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
  • ich hab mal versucht einen fs speedo meter zu basteln.


    #include <a_samp>


    #if defined FILTERSCRIPT


    #define SLOTS 200




    enum SavePlayerPosEnum {
    Float:LastX,
    Float:LastY,
    Float:LastZ
    }



    new SLOTS
    new SavePlayerPos[SLOTS][SavePlayerPosEnum]
    new Text:Speedo[SLOTS]
    new UpdateSeconds
    new TelePos[256]
    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", "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"
    };


    public SpeedoMeter()
    {
    new plname[MAX_PLAYER_NAME];
    new string[256];
    new Float:maxspeed = 10000.0;
    for(new i = 0; i <= MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i) == 1 && (GetPlayerState(i) == 2))
    {
    GetPlayerPos(i, TelePos[i][3], TelePos[i][4], TelePos[i][5]);
    if(TelePos[i][5] > 550.0)
    {
    TelePos[i][0] = 0.0;
    TelePos[i][1] = 0.0;
    }
    //printf("player %d\n x = %f\n y = %f\n z = %f\n x2 = %f\n y2 = %f\n z2 = %f\n",i, PlayerPos[i][0],PlayerPos[i][1],PlayerPos[i][2],PlayerPos[i][3],PlayerPos[i][4],PlayerPos[i][5]);
    if(TelePos[i][0] != 0.0)
    {
    new Float:xdist = TelePos[i][3]-TelePos[i][0];
    new Float:ydist = TelePos[i][4]-TelePos[i][1];
    new Float:sqxdist = xdist*xdist;
    new Float:sqydist = ydist*ydist;
    new Float:distance = (sqxdist+sqydist)/10;
    new Float:health;
    GetVehicleHealth(GetPlayerVehicleID(i), health);
    if(gSpeedo[i] == 1) //speedo meter :D :P
    {
    if(distance <10)
    {
    format(string, 256, "~n~~n~~n~~n~~n~~b~Vehicle: ~g~%s ~n~~b~Kp/h: ~g~%.0f~n~~b~Health: ~r~%d ~y~/ ~b~Fuel: ~r~%d%",CarName[GetVehicleModel(GetPlayerVehicleID(i))-400],distance,floatround(health/10),Diesel[GetPlayerVehicleID(i)]);
    }
    if(distance > 10 && distance < 100)
    {
    format(string, 256, "~n~~n~~n~~n~~n~~b~Vehicle: ~g~%s ~n~~b~Kp/h: ~g~%.0f~n~~b~Health: ~r~%d ~y~/ ~b~Fuel: ~r~%d%",CarName[GetVehicleModel(GetPlayerVehicleID(i))-400],distance,floatround(health/10),Diesel[GetPlayerVehicleID(i)]);
    }
    if(distance > 100)
    {
    format(string, 256, "~n~~n~~n~~n~~n~~b~Vehicle: ~g~%s ~n~~b~Kp/h: ~g~%.0f~n~~b~Health: ~r~%d ~y~/ ~b~Fuel: ~r~%d%",CarName[GetVehicleModel(GetPlayerVehicleID(i))-400],distance,floatround(health/10),Diesel[GetPlayerVehicleID(i)]);
    }
    GameTextForPlayer(i, string, 2000, 5);
    }
    if(Diesel[GetPlayerVehicleID(i)] == 0 && Filling[i] == 0)
    {
    format(carmess, sizeof(carmess), "Your %s's fuel has dropped to 0% and it was towed away. Enjoy the walk!",CarName[GetVehicleModel(GetPlayerVehicleID(i))-400]);
    SendClientMessage(i,COLOR_BRIGHTRED,carmess);
    Diesel[GetPlayerVehicleID(i)] = 100;
    SetVehicleToRespawn(GetPlayerVehicleID(i));
    //SetTimer("resetmessage",7000,0);
    }
    if(GetPlayerMoney(i) <= 2 && Filling[i] == 1) {
    Filling[i] = 0;
    SendClientMessage(i,COLOR_BRIGHTRED, "You do not have sufficient money to continue filling your vehicle!");
    }
    if(distance > maxspeed)
    {
    new tmpcar = GetPlayerVehicleID(i);
    if(!IsAPlane(tmpcar))
    {
    GetPlayerName(i, plname, sizeof(plname));
    format(string, 256, "AdmWarning: [%d]%s %.0f kp/h",i,plname,distance);
    Speeder = i;
    ABroadCast(FARBE_GELB,string,1);
    }
    }
    }


    forward UpdateSpeed();


    public OnFilterScriptInit()
    {
    print("\n--------------------------------------");
    print(" Speedo Meter by Seko45 ");
    print("--------------------------------------\n");
    return 1;
    }


    public OnFilterScriptExit()
    {
    return 1;
    }


    main()
    {
    }


    public OnPlayerConnect(playerid)
    {
    SendClientMessage(playerid,0x00FF00FF,"Der Server läuft mit Seko's speedometer!");
    return 1;
    }


    public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    if(newstate == PLAYER_STATE_ONFOOT)
    {
    TextDrawHideForPlayer(playerid, Speedo[playerid]);
    }
    return 1;
    }


    public UpdateSpeed()
    {
    new Float:x,Float:y,Float:z;
    new Float:distance,value,string[256];
    new Float:health;
    for(new i=0; i<SLOTS; i++)
    {
    if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
    {
    TextDrawDestroy(Speedo[i]);
    }
    }


    for(new i=0; i<SLOTS; i++)
    {
    if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
    {
    GetPlayerPos(i, x, y, z);
    GetVehicleHealth(GetPlayerVehicleID(i), health);
    distance = floatsqroot(floatpower(floatabs(floatsub(x,SavePlayerPos[i][LastX])),2)+floatpower(floatabs(floatsub(y,SavePlayerPos[i][LastY])),2)+floatpower(floatabs(floatsub(z,SavePlayerPos[i][LastZ])),2));
    value = floatround(distance * 5000);
    if(UpdateSeconds > 1)
    {
    value = floatround(value / UpdateSeconds);
    }
    format(string,sizeof(string),"~g~Auto : ~w~%s ~n~~b~MPH : ~w~%d / ~b~KM/H : ~w~%d~n~~y~Altitude:~w~ %.1f ~n~~r~Autoleben:~w~ %.2f",CarName[GetVehicleModel(GetPlayerVehicleID(i))-400],floatround(value/1600),floatround(value/1000),z,health);
    Speedo[i] = TextDrawCreate(320.00, 380.00, string);
    TextDrawSetOutline(Speedo[i], 0);
    TextDrawFont(Speedo[i], 3);
    TextDrawSetProportional(Speedo[i], 2);
    TextDrawAlignment(Speedo[i], 2);
    TextDrawShowForPlayer (i, Speedo[i]);
    }
    SavePlayerPos[i][LastX] = x;
    SavePlayerPos[i][LastY] = y;
    SavePlayerPos[i][LastZ] = z;
    }
    )
    #endif


    und jetzt ist mein problem es zeigt keine errors oder sonstiges blos es funktionier im game nicht warum?


    bitte um hilfe. Danke im vorraus
    mfg seko45

  • Echt erbärmlich wie du andere Scripte verwenden tust und dann einfach das Copyright entfernst und dann dein eigenes reinsetzt.


    Das Spee'o'meter was du für deins erklärst gehört dem "R@F aus dem offizellen SA-MP Forum"
    Den Gamemode den du auf deinem Server laufen hast gehört GodFather und nicht dir.
    Pass auf das du kein ärger bekommst wenn du fremde scripte für dich benutzt und dann noch dreist behauptest das sie dir gehören.



    Hier das Original Script das ja angeblich seins wäre
    http://forum.sa-mp.com/index.php?topic=33338.0



    //-----0000----0----0--------00000---------0-------000000-----------------------
    //-----0---0----0--0---------0----0-------0-0------0----------------------------
    //-----0000------0-----------00000-------0---0-----00000------------------------
    //-----0---0----0------------0-00-------0000000----0----------------------------
    //-----0000----0-------------0---00----0-------0---0-----------------by R@f ©---
    #include <a_samp>


    #define SLOTS 200


    enum SavePlayerPosEnum {
    Float:LastX,
    Float:LastY,
    Float:LastZ
    }


    new SavePlayerPos[SLOTS][SavePlayerPosEnum];
    new Text:Speedo[SLOTS];
    new UpdateSeconds;


    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", "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"
    };


    forward UpdateSpeed();


    public OnFilterScriptInit()
    {
    print("\n--------------------------------------");
    print("----------R@f's speedo script---------");
    print("--------------------------------------\n");
    SetTimer("UpdateSpeed",1000, 1);
    return 1;
    }


    public OnFilterScriptExit()
    {
    return 1;
    }


    main()
    {
    }


    public OnPlayerConnect(playerid)
    {
    SendClientMessage(playerid,0x00FF00FF,"This server is running whit R@f's Speedo FilterScript");
    return 1;
    }


    public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    if(newstate == PLAYER_STATE_ONFOOT)
    {
    TextDrawHideForPlayer(playerid, Speedo[playerid]);
    }
    return 1;
    }


    public UpdateSpeed()
    {
    new Float:x,Float:y,Float:z;
    new Float:distance,value,string[256];
    new Float:health;
    for(new i=0; i<SLOTS; i++)
    {
    if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
    {
    TextDrawDestroy(Speedo[i]);
    }
    }


    for(new i=0; i<SLOTS; i++)
    {
    if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
    {
    GetPlayerPos(i, x, y, z);
    GetVehicleHealth(GetPlayerVehicleID(i), health);
    distance = floatsqroot(floatpower(floatabs(floatsub(x,SavePlayerPos[i][LastX])),2)+floatpower(floatabs(floatsub(y,SavePlayerPos[i][LastY])),2)+floatpower(floatabs(floatsub(z,SavePlayerPos[i][LastZ])),2));
    value = floatround(distance * 5000);
    if(UpdateSeconds > 1)
    {
    value = floatround(value / UpdateSeconds);
    }
    format(string,sizeof(string),"~g~Vehicle : ~w~%s ~n~~b~MPH : ~w~%d / ~b~KM/H : ~w~%d~n~~y~Altitude:~w~ %.1f ~n~~r~Vehicle Health:~w~ %.2f",CarName[GetVehicleModel(GetPlayerVehicleID(i))-400],floatround(value/1600),floatround(value/1000),z,health);
    Speedo[i] = TextDrawCreate(320.00, 380.00, string);
    TextDrawSetOutline(Speedo[i], 0);
    TextDrawFont(Speedo[i], 3);
    TextDrawSetProportional(Speedo[i], 2);
    TextDrawAlignment(Speedo[i], 2);
    TextDrawShowForPlayer (i, Speedo[i]);
    }
    SavePlayerPos[i][LastX] = x;
    SavePlayerPos[i][LastY] = y;
    SavePlayerPos[i][LastZ] = z;
    }
    }

    Einmal editiert, zuletzt von Sebastian ()

  • Was willst du man ich hab das Filterscript so geschickt bekokmmen okay
    Und als ich gesagt hab das er meins haben kann war das nicht gemeint das ich das gemacht habe
    Also tu nicht einen auf Klugschei*er


    Und nein das ist wohl nicht das gleiche speedometer wie meinst , meins ist links auf der Karte !