new Float:svx[MAX_PLAYERS], Float:svy[MAX_PLAYERS],Float:svz[MAX_PLAYERS],Float:s1[MAX_PLAYERS], s2[MAX_PLAYERS],s3[MAX_PLAYERS][256],Text:speedokijelzo,stimer[MAX_PLAYERS];forward speedometer(playerid);public OnGameModeInit(){//================textdraw=====================speedokijelzo = TextDrawCreate(581 ,407 , \" \");TextDrawFont(speedokijelzo , 2);TextDrawLetterSize(speedokijelzo , 0.3, 2.1);TextDrawColor(speedokijelzo , 0xff0000FF);TextDrawSetOutline(speedokijelzo , false);TextDrawSetProportional(speedokijelzo , true);TextDrawSetShadow(speedokijelzo , 1);}public OnPlayerStateChange(playerid, newstate, oldstate){ if(newstate == PLAYER_STATE_DRIVER) { stimer[playerid] = SetTimerEx(\"speedometer\", 255, true, \"i\", playerid); }return 1;}public speedometer(playerid){ GetVehicleVelocity(GetPlayerVehicleID(playerid), svx[playerid], svy[playerid], svz[playerid]); s1[playerid] = floatsqroot(((svx[playerid]*svx[playerid])+(svy[playerid]*svy[playerid]))+(svz[playerid]*svz[playerid]))*136.666667; s2[playerid] = floatround(s1[playerid],floatround_round); format(s3[playerid],256,\"~k~~r~%i ~b~~k~KMH\", s2[playerid]); TextDrawSetString(speedokijelzo, s3[playerid]); return 1;}
#include <a_samp>new Float:svx[MAX_PLAYERS], Float:svy[MAX_PLAYERS], Float:svz[MAX_PLAYERS], Float:s1[MAX_PLAYERS], s2[MAX_PLAYERS], s3[MAX_PLAYERS][256], stimer[MAX_PLAYERS];new PlayerText:speedotext[MAX_PLAYERS]; forward speedometer(playerid);public speedometer(playerid){ GetVehicleVelocity(GetPlayerVehicleID(playerid), svx[playerid], svy[playerid], svz[playerid]); s1[playerid] = floatsqroot(((svx[playerid]*svx[playerid])+(svy[playerid]*svy[playerid]))+(svz[playerid]*svz[playerid]))*136.666667; s2[playerid] = floatround(s1[playerid],floatround_round); format(s3[playerid],256,\"%i KMH\", s2[playerid]); PlayerTextDrawSetString(playerid,speedotext[playerid], s3[playerid]); return 1;}public OnFilterScriptInit(){print(\"\\n--------------------------------------\");print(\" Speedo jav. 4 kriszrap by RedNET (founded by Red-Eye)\");print(\"--------------------------------------\\n\");//textdraw //textdrawreturn 1;}public OnFilterScriptExit(){return 1;}public OnPlayerConnect(playerid){ speedotext[playerid] = CreatePlayerTextDraw(playerid,581 ,407, \" \"); PlayerTextDrawFont(playerid,speedotext[playerid] , 2); PlayerTextDrawLetterSize(playerid,speedotext[playerid] , 0.3, 2.1); PlayerTextDrawColor(playerid,speedotext[playerid] , 0xff0000FF); PlayerTextDrawSetOutline(playerid,speedotext[playerid] , false); PlayerTextDrawSetProportional(playerid,speedotext[playerid] , true); PlayerTextDrawSetShadow(playerid,speedotext[playerid] , 1);}public OnPlayerDeath(playerid, killerid, reason){ KillTimer(stimer[playerid]);PlayerTextDrawHide(playerid,speedotext[playerid]);return 1;}public OnPlayerExitVehicle(playerid, vehicleid){KillTimer(stimer[playerid]);PlayerTextDrawHide(playerid,speedotext[playerid]);return 1;}public OnPlayerStateChange(playerid, newstate, oldstate){ if(newstate == PLAYER_STATE_DRIVER) { stimer[playerid] = SetTimerEx(\"speedometer\", 255, true, \"i\", playerid); PlayerTextDrawShow(playerid,speedotext[playerid]); } return 1;}
public OnPlayerStateChange(playerid, newstate, oldstate){ if(newstate == PLAYER_STATE_DRIVER) { stimer[playerid] = SetTimerEx(\"speedometer\", 255, true, \"i\", playerid); PlayerTextDrawShow(playerid,speedotext[playerid]); }else if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT) { KillTimer(stimer[playerid]); PlayerTextDrawHide(playerid,speedotext[playerid]);} return 1;}