GTA Közösség - A magyar GTA fórum

San Andreas Multiplayer (SA-MP) => SA-MP: Szerverfejlesztés => Segítségkérés => A témát indította: BoSS - 2012. március 01. - 19:59:35

Cím: Sebességmérõ HELP
Írta: BoSS - 2012. március 01. - 19:59:35
Hy van ez a sebességmérõm amit most szedtem le a netrõl és azt szeretném,hogy reálisabban mérjen mert most jelen pillanat a Sultan autóra 120 KM/h mutat ezt,hogy tudom változtatni??
Itt a Script
[pawn]#include <a_samp>
#define GREEN 0x21DD00FF
#define ORANGE 0xF97804FF
#define RED 0xE60000FF
forward VehStateCheck();
new Text:Vehicle[MAX_PLAYERS];
new Text:VehiclesName[MAX_PLAYERS];
new Text:KPH[MAX_PLAYERS];
new Text:KPHR[MAX_PLAYERS];
new Text:VHP[MAX_PLAYERS];
new Text:VHPR[200];
new VehicleName[][] = {
   \"Landstalker\",
   \"Bravura\",
   \"Buffalo\",
   \"Linerunner\",
   \"Pereniel\",
   \"Sentinel\",
   \"Dumper\",
   \"Firetruck\",
   \"Trashmaster\",
   \"Stretch\",
   \"Manana\",
   \"Infernus\",
   \"Voodoo\",
   \"Pony\",
   \"Mule\",
   \"Cheetah\",
   \"Ambulance\",
   \"Leviathan\",
   \"Moonbeam\",
   \"Esperanto\",
   \"Taxi\",
   \"Washington\",
   \"Bobcat\",
   \"Mr 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\",
   \"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\",
   \"PD Maverick\",
   \"Boxville\",
   \"Benson\",
   \"Mesa\",
   \"RC Goblin\",
   \"Hotring\",
   \"Hotring\",
   \"Bloodring\",
   \"Rancher\",
   \"Super GT\",
   \"Elegant\",
   \"Journey\",
   \"Bike\",
   \"Mountain Bike\",
   \"Beagle\",
   \"Cropdust\",
   \"Stunt\",
   \"Tanker\",
   \"RoadTrain\",
   \"Nebula\",
   \"Majestic\",
   \"Buccaneer\",
   \"Shamal\",
   \"Hydra\",
   \"FCR-900\",
   \"NRG-500\",
   \"HPV1000\",
   \"Cement\",
   \"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\",
   \"Trailer\",
   \"Kart\",
   \"Mower\",
   \"Duneride\",
   \"Sweeper\",
   \"Broadway\",
   \"Tornado\",
   \"AT-400\",
   \"DFT-30\",
   \"Huntley\",
   \"Stafford\",
   \"BF-400\",
   \"Newsvan\",
   \"Tug\",
   \"Trailer\",
   \"Emperor\",
   \"Wayfarer\",
   \"Euros\",
   \"Hotdog\",
   \"Club\",
   \"Trailer\",
   \"Trailer\",
   \"Andromada\",
   \"Dodo\",
   \"RC Cam\",
   \"Launch\",
   \"Police Car\",
   \"Police Car\",
   \"Police Car\",
   \"Police Ranger\",
   \"Picador\",
   \"S.W.A.T\",
   \"Alpha\",
   \"Phoenix\",
   \"Glendale\",
   \"Sadler\",
   \"Luggage Trailer\",
   \"Luggage Trailer\",
   \"Stair Trailer\",
   \"Boxville\",
   \"Farm Plow\",
   \"Utility Trailer\"
};
new VehStats[200];
enum SPS
{
    Float:X,
    Float:Y,
    Float:Z
}
new PlayerPos[200][sPS];
public OnFilterScriptInit()
{
    print(\"***********************************\");
print(\"*     SpeedoMeter By DokerJr      *\");
print(\"*   Speedometer, CarHP, VehName   *\");
print(\"*   YAHOO: [email protected]  *\");
print(\"***********************************\");
SetTimer(\"VehStateCheck\",300,1);
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
   //Vehicle:
    VehStats[playerid] = 1;
    Vehicle[playerid] = TextDrawCreate(498.000000,114.000000,\"Tipus:\");
    TextDrawAlignment(Vehicle[playerid],0);
        TextDrawBackgroundColor(Vehicle[playerid],0xFF0606FF);
    TextDrawFont(Vehicle[playerid],3);
    TextDrawLetterSize(Vehicle[playerid],0.400000,1.600000);
    TextDrawColor(Vehicle[playerid],0xC0C0C0FF);
    TextDrawSetOutline(Vehicle[playerid],1);
    TextDrawSetProportional(Vehicle[playerid],1);
    TextDrawSetShadow(Vehicle[playerid],1);
   VehiclesName[playerid] = TextDrawCreate(530.000000,114.000000,\"-\");
   TextDrawAlignment(VehiclesName[playerid],0);
   TextDrawFont(VehiclesName[playerid],3);
   TextDrawBackgroundColor(VehiclesName[playerid],0xFF0606FF);
   TextDrawLetterSize(VehiclesName[playerid],0.399999,1.600000);
   TextDrawColor(VehiclesName[playerid],0xC0C0C0FF);
   TextDrawSetOutline(VehiclesName[playerid],1);
   TextDrawSetProportional(VehiclesName[playerid],1);
   TextDrawSetShadow(VehiclesName[playerid],1);
   KPH[playerid] = TextDrawCreate(498.000000,130.000000,\"Speed:\");
   TextDrawAlignment(KPH[playerid],0);
   TextDrawBackgroundColor(KPH[playerid],0xC0C0C0FF);
   TextDrawFont(KPH[playerid],3);
   TextDrawLetterSize(KPH[playerid],0.399999,1.500000);
   TextDrawColor(KPH[playerid],0xFF0606FF);
   TextDrawSetOutline(KPH[playerid],1);
   TextDrawSetProportional(KPH[playerid],1);
   TextDrawSetShadow(KPH[playerid],1);
   KPHR[playerid] = TextDrawCreate(551.000000,130.000000,\"287\");
   TextDrawAlignment(KPHR[playerid],0);
   TextDrawBackgroundColor(KPHR[playerid],0xC0C0C0FF);
   TextDrawFont(KPHR[playerid],3);
   TextDrawLetterSize(KPHR[playerid],0.499999,1.500000);
   TextDrawColor(KPHR[playerid],0xFF0606FF);
   TextDrawSetOutline(KPHR[playerid],1);
   TextDrawSetProportional(KPHR[playerid],1);
   TextDrawSetShadow(KPHR[playerid],1);
   VHPR[playerid] = TextDrawCreate(550.000000,99.000000,\"1000\");
   TextDrawAlignment(VHPR[playerid],0);
   TextDrawBackgroundColor(VHPR[playerid],0xC0C0C0FF);
   TextDrawFont(VHPR[playerid],3);
   TextDrawLetterSize(VHPR[playerid],0.399999,1.600000);
   TextDrawColor(VHPR[playerid],0xFF0606FF);
   TextDrawSetOutline(VHPR[playerid],1);
   TextDrawSetProportional(VHPR[playerid],1);
   TextDrawSetShadow(VHPR[playerid],1);
   VHP[playerid] = TextDrawCreate(498.000000,99.000000,\"Elet:\");
   TextDrawAlignment(VHP[playerid],0);
   TextDrawBackgroundColor(VHP[playerid],0xC0C0C0FF);
   TextDrawFont(VHP[playerid],3);
   TextDrawLetterSize(VHP[playerid],0.399999,1.600000);
   TextDrawColor(VHP[playerid],0xFF0606FF);
   TextDrawSetProportional(VHP[playerid],1);
   TextDrawSetShadow(VHP[playerid],1);
   TextDrawSetOutline(VHP[playerid],1);
}
return 1;
}
public OnFilterScriptExit()
{
    for(new i = 0;i < MAX_PLAYERS; i++)
    {
         TextDrawHideForPlayer(i,Vehicle);

   TextDrawHideForPlayer(i,VehiclesName
);

   TextDrawHideForPlayer(i,KPH
);

   TextDrawHideForPlayer(i,KPHR
);

       TextDrawHideForPlayer(i,VHPR
);

       TextDrawHideForPlayer(i,VHP
);

    }


return 1;


}


public OnPlayerConnect(playerid)


{


VehStats[playerid] = 1;


return 1;


}


public OnPlayerCommandText(playerid, cmdtext[])


{


if(strcmp(cmdtext, \"/vstatics\", true) == 0)


{


    if (VehStats[playerid] == 1)


   {


      VehStats[playerid] = 0;


      SendClientMessage(playerid,GREEN,\"Vehicle Statistics - OFF\");


      TextDrawHideForPlayer(playerid,Vehicle[playerid]);


      TextDrawHideForPlayer(playerid,VehiclesName[playerid]);


      TextDrawHideForPlayer(playerid,KPH[playerid]);


      TextDrawHideForPlayer(playerid,KPHR[playerid]);


      TextDrawHideForPlayer(playerid,VHPR[playerid]);


      TextDrawHideForPlayer(playerid,VHP[playerid]);


   }


    else


    {


      VehStats[playerid] = 1;


      SendClientMessage(playerid,GREEN,\"Vehicle Statistics - ON\");


      if(GetPlayerState(playerid) == 2)


      {


                TextDrawShowForPlayer(playerid,Vehicle[playerid]);


         TextDrawShowForPlayer(playerid,VehiclesName[playerid]);


         TextDrawShowForPlayer(playerid,KPH[playerid]);


         TextDrawShowForPlayer(playerid,KPHR[playerid]);


         TextDrawShowForPlayer(playerid,VHPR[playerid]);


         TextDrawShowForPlayer(playerid,VHP[playerid]);


      }


   }


   return 1;


}


return 0;


}


public VehStateCheck()


{


for(new i=0;i<MAX_PLAYERS;i++)


{


   if (IsPlayerInAnyVehicle(i) && IsPlayerConnected(i) && VehStats
== 1)

    {


      new Float:health,vehicleid = GetPlayerVehicleID(i),string[128],str[128],strg[128],s[128],Float:value,Float:distance,Float:x,Float:y,Float:z;


            GetPlayerPos(i, x, y, z);


            distance = floatsqroot(floatpower(floatabs(floatsub(x,PlayerPos
[X])),2)+floatpower(floatabs(floatsub(y,PlayerPos[Y])),2)+floatpower(floatabs(floatsub(z,PlayerPos[Z])),2));

            value = floatround(distance * 11000);


      GetVehicleHealth(vehicleid,health);


            format(str, 128, \"%d\",floatround(value/2200));


            format(strg, 128, \"%d\",floatround(value/1400));


            format(string,128,\"%s\",VehicleName[GetVehicleModel(vehicleid)-400]);


      format(s,10,\"%.0f\",health);


            TextDrawSetString(VehiclesName
,string);

            TextDrawSetString(KPHR
,strg);

            TextDrawSetString(VHPR
,s);

      PlayerPos
[X] = x;

            PlayerPos
[Y] = y;

            PlayerPos
[Z] = z;

       }


}


return 1;


}


public OnPlayerStateChange(playerid, newstate, oldstate)


{


if (newstate == PLAYER_STATE_DRIVER)


{


    if (VehStats[playerid] == 1)


   {


      TextDrawShowForPlayer(playerid,Vehicle[playerid]);


      TextDrawShowForPlayer(playerid,VehiclesName[playerid]);


      TextDrawShowForPlayer(playerid,KPH[playerid]);


      TextDrawShowForPlayer(playerid,KPHR[playerid]);


      TextDrawShowForPlayer(playerid,VHPR[playerid]);


      TextDrawShowForPlayer(playerid,VHP[playerid]);


   }


}


else if (newstate == PLAYER_STATE_ONFOOT)


{


   TextDrawHideForPlayer(playerid,Vehicle[playerid]);


   TextDrawHideForPlayer(playerid,VehiclesName[playerid]);


   TextDrawHideForPlayer(playerid,KPH[playerid]);


   TextDrawHideForPlayer(playerid,KPHR[playerid]);


   TextDrawHideForPlayer(playerid,VHPR[playerid]);


   TextDrawHideForPlayer(playerid,VHP[playerid]);


}


return 1;


}[/pawn]


Elõre is köszi a segítséget.
Cím: Sebességmérõ HELP
Írta: nyE - 2012. március 01. - 20:07:25
value = floatround(distance * 11000);
Ezen kell állítani.
Cím: Sebességmérõ HELP
Írta: BoSS - 2012. március 01. - 20:16:26
Idézetet írta: Antonyo date=1330628845\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"17826\" data-ipsquote-contentclass=\"forums_Topic
value = floatround(distance * 11000);
Ezen kell állítani.
 
Köszönöm szépen ment a +