Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
- /////////////////// ??? SISTEMA DE VELOCIMETRO + CAR ///////////////////////////
- /////////////////// ??? CODADO POR BLACK DONELLY ///////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
- #include <a_samp>
- #include <progress>
- static Text:Velocimetro[MAX_PLAYERS],Bar:carhealth[MAX_PLAYERS],bool:Vel[MAX_PLAYERS];
- forward VelUpdate();
- #define FILTERSCRIPT
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Sistema Velocimetro + CarDmg Carregado");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #endif
- public OnPlayerUpdate(playerid)
- {
- new string[32];
- new Float:Vhealth;
- if(!IsPlayerConnected(playerid)) return 1;
- if(Vel[playerid] == true)
- {
- GetVehicleHealth(GetPlayerVehicleID(playerid),Vhealth);
- format(string, sizeof(string), "~g~%d~w~ KM/H~n~Dano: ~r~%d",GetVehicleSpeed(playerid),floatround(Vhealth));
- TextDrawSetString(Velocimetro[playerid],string);
- SetProgressBarMaxValue(carhealth[playerid], 1000.0);
- SetProgressBarValue(carhealth[playerid], floatround(Vhealth));
- UpdateProgressBar(carhealth[playerid],playerid);
- if(IsPlayerInAnyVehicle(playerid))
- {
- TextDrawShowForPlayer(playerid,Velocimetro[playerid]);
- ShowProgressBarForPlayer(playerid,carhealth[playerid]);
- }
- else
- {
- TextDrawHideForPlayer(playerid,Velocimetro[playerid]);
- HideProgressBarForPlayer(playerid,carhealth[playerid]);
- }
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- Vel[playerid] = true;
- Velocimetro[playerid] = TextDrawCreate(37.000000, 288.000000, " ");
- TextDrawBackgroundColor(Velocimetro[playerid], 255);
- TextDrawFont(Velocimetro[playerid], 1);
- TextDrawLetterSize(Velocimetro[playerid], 0.539999, 2.000000);
- TextDrawColor(Velocimetro[playerid], -1);
- TextDrawSetOutline(Velocimetro[playerid], 0);
- TextDrawSetProportional(Velocimetro[playerid], 1);
- TextDrawSetShadow(Velocimetro[playerid], 1);
- carhealth[playerid] = CreateProgressBar(27.00, 328.00, 130.50, 8.19, 10289322, 1000.0);
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (!strcmp("/mostrarvel", cmdtext, true))
- {
- Vel[playerid] = true;
- TextDrawShowForPlayer(playerid,Velocimetro[playerid]);
- ShowProgressBarForPlayer(playerid,carhealth[playerid]);
- return 1;
- }
- if (!strcmp("/apagarvel", cmdtext, true))
- {
- Vel[playerid] = false;
- TextDrawHideForPlayer(playerid,Velocimetro[playerid]);
- HideProgressBarForPlayer(playerid,carhealth[playerid]);
- return 1;
- }
- return 0;
- }
- stock GetVehicleSpeed(playerid)
- {
- if(!IsPlayerInAnyVehicle(playerid)) return 1;
- new Float:vPos[3];
- GetVehicleVelocity(GetPlayerVehicleID(playerid), vPos[0], vPos[1], vPos[2]);
- return floatround((floatmul(floatsqroot(floatpower(vPos[0], 2.0) + floatpower(vPos[1], 2.0) + floatpower(vPos[2], 2.0)), 100.0) / 0.4463), floatround_floor);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement