13.04.2011, 19:33
Hello, im trying to make a speedometer, but i have 1 problem with textdraws. So now there are this codes in filterscript:
At the filterscript start:
OnPlayerEnterVehicle:
OnPlayerExitVehicle:
And in script down there are Matuoja timer and stock GetPlayerSpeed:
So now the problem is, when i driving a car, it will makes much of speed texts, like this one: here
But why?
At the filterscript start:
Код:
new Text:greitis; forward Matuoja(playerid);
Код:
SetTimerEx("Matuoja",500,true,"i",playerid);
Код:
TextDrawDestroy(greitis);
Код:
public Matuoja(playerid) { new kmh[128]; format(kmh, 128, "Greitis: %i", GetPlayerSpeed(playerid)); greitis = TextDrawCreate(160, 349, kmh); TextDrawFont(greitis , 2); TextDrawLetterSize(greitis , 0.4, 1); TextDrawColor(greitis , 0xC6D134FF); TextDrawSetOutline(greitis , 0); TextDrawSetProportional(greitis , 1); TextDrawSetShadow(greitis , 0); TextDrawShowForPlayer(playerid, greitis); } stock GetPlayerSpeed(playerid) { new Float:ST[4]; if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]); else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]); ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 180.3; return floatround(ST[3]); }
But why?