17.07.2015, 23:54
PHP код:
// This belongs under OnPlayerUpdate
static str[7] /* Works fine, but when "new str[7]" doesn't work at all and GetVehicleSpeed returns 0. */
new Float:speed = GetVehicleSpeed(vid,false);
new round = floatround(speed);
vid = GetPlayerVehicleID(playerid);
format(str,sizeof(str),"%i MPH",round);
PlayerTextDrawSetString(playerid,Speed[playerid],str);
printf("(Speed: %i)",round);
"Str" variable isn't static:
pawn Код:
[03:00:18] (Speed: 0)
[03:00:18] (Speed: 0)
[03:00:18] (Speed: 0)
[03:00:18] (Speed: 0)
pawn Код:
[03:01:21] (Speed: 47)
[03:01:22] (Speed: 48)
[03:01:22] (Speed: 47)
[03:01:22] (Speed: 46)
[03:01:22] (Speed: 46)
[03:01:22] (Speed: 45)
[03:01:22] (Speed: 44)
[03:01:22] (Speed: 43)