SA-MP Forums Archive
speedo. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: speedo. (/showthread.php?tid=182430)



speedo. - Gh0sT_ - 10.10.2010

Hello all, so im tryied do speed show, when speed are > 90.. but, when i enter a car, ant just stay, its show red, not yellow. ( i mean that, if speed < 90 - yellow if speed > 90 - red. )

script:

pawn Код:
if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInAnyVehicle(playerid))
            {

                if(TextShow[playerid] == false)
                {
                    TextShow[playerid] = true;
                }
                new vehicleid = GetPlayerVehicleID(playerid);
                new model = GetVehicleModel(vehicleid);
                new String[128];
                new HH, MM, SS;
                gettime(HH, MM, SS);
                new Float:vX, Float:vY, Float:vZ, Float:Speed;
                if(model == BMX || model == MTBIKE || model == BIKE)
                {
                    GetVehicleVelocity(GetPlayerVehicleID(playerid), vX, vY, vZ);
                    Speed = floatmul(floatsqroot(floatadd(floatadd(floatpower(vX, 2), floatpower(vY, 2)),  floatpower(vZ, 2))), 100.0);
                    format(String,sizeof(String)," ~g~Dviratis: ~y~%s~n~ ~g~Greitis: ~y~%i~n~ ~g~Valandos: ~y~%d:%d",aVehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400], floatround(Speed, floatround_floor),HH,MM);
                }else{
                    GetVehicleVelocity(GetPlayerVehicleID(playerid), vX, vY, vZ);
                    Speed = floatmul(floatsqroot(floatadd(floatadd(floatpower(vX, 2), floatpower(vY, 2)),  floatpower(vZ, 2))), 200.0);
                    format(String,sizeof(String)," ~g~Automobilis: ~y~%s~n~ ~g~Greitis: ~y~%i~n~ ~g~Degalai: ~y~%iL~n~ ~g~Valandos: ~y~%d:%d",aVehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400],floatround(Speed, floatround_floor),vehicleDB[GetPlayerVehicleID(playerid)][gas],HH,MM);
                }
                else if(model != BMX || model != MTBIKE || model != BIKE && GetPlayerSpeed(playerid) > 89)
                {
                format(String,sizeof(String)," ~g~Automobilis: ~y~%s~n~ ~g~Greitis: ~r~%i~n~ ~g~Degalai: ~y~%iL~n~ ~g~Valandos: ~y~%d:%d",aVehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400],floatround(Speed, floatround_floor),vehicleDB[GetPlayerVehicleID(playerid)][gas],HH,MM);
                }
                if(VHSCreated[playerid] == true)
                {
                    TextDrawDestroy(VHS[playerid]);
                }
                VHS[playerid] = TextDrawCreate(495.000000,122.000000,String);
                TextDrawAlignment(VHS[playerid],0);
                TextDrawBackgroundColor(VHS[playerid],0x000000ff);
                TextDrawFont(VHS[playerid],1);
                TextDrawLetterSize(VHS[playerid],0.299999,1.000000);
                TextDrawColor(VHS[playerid],0xffffffff);
                TextDrawSetOutline(VHS[playerid],1);
                TextDrawSetProportional(VHS[playerid],1);
                TextDrawSetShadow(VHS[playerid],1);
                TextDrawShowForPlayer(playerid, VHS[playerid]);
                VHSCreated[playerid] = true;

            }else{
                if(TextShow[playerid] == true)
                {
                    TextDrawHideForPlayer(playerid, Text:VHS[playerid]);
                    TextShow[playerid] = false;
                }
            }
}



Re: speedo. - Austin - 10.10.2010

Could just use the formatting ~y~ and ~r~, no?


Re: speedo. - Gh0sT_ - 10.10.2010

yes. 8chz


Re: speedo. - Gh0sT_ - 12.10.2010

bump, 24h over.


Re: speedo. - Gh0sT_ - 13.10.2010

Bump! please help me


Re: speedo. - Austin - 13.10.2010

I did, didn't I?


Re: speedo. - Gh0sT_ - 14.10.2010

Im didn't understand it. >.>


Re: speedo. - Austin - 14.10.2010

I do not understand the question fully. Seems you want yellow text and red text, is that right?


Re: speedo. - Gh0sT_ - 15.10.2010

Yes. But only when player car speed are > 89 ( speedometer will b red ), but if car speed are < 89 (speedometer will b yellow )


Re: speedo. - Gh0sT_ - 15.10.2010

buumpy.;/