Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define YELLOW 0xF6F600AA
- forward SpeedoUpdate();
- new Text:box[MAX_PLAYERS],Text:speed[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- SetTimer("SpeedoUpdate",100,1);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- speed[playerid] = TextDrawCreate(499.00,102.000000,"_");
- TextDrawLetterSize(speed[playerid],0.5,2);
- TextDrawSetOutline(speed[playerid],2);
- TextDrawColor(speed[playerid],YELLOW);
- TextDrawFont(speed[playerid],1);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- TextDrawDestroy(speed[playerid]);
- return 1;
- }
- public SpeedoUpdate()
- {
- for(new i = 0;i<MAX_PLAYERS;i++)
- {
- if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
- {
- new Float:x,Float:y,Float:z,Float:hp,string[24],vehicleid = GetPlayerVehicleID(i);
- TextDrawShowForPlayer(i,speed[i]);
- GetVehicleVelocity(vehicleid,x,y,z);
- format(string,sizeof(string),"Brzina: %dkph",floatround(floatsqroot(((x*x)+(y*y))+(z*z))*250.666667));
- TextDrawSetString(speed[i],string);
- format(string,sizeof(string),"Health: %d",floatround(hp));
- }
- if(!IsPlayerInAnyVehicle(i))
- {
- TextDrawHideForPlayer(i,box[i]);
- TextDrawHideForPlayer(i,speed[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement