04.06.2007, 18:37
Hey,
Why it doesn't work?
Beginning of file:
OnGameModeInit Callback:
End of file:
Why it doesn't work?
Beginning of file:
Code:
new speedtimer; new Float:newpos[MAX_PLAYERS][3]; new Float:oldpos[MAX_PLAYERS][3]; new Text: gText;
Code:
speedtimer = SetTimer("speedofplayer",500,1);
Code:
public speedofplayer() { new Float:speed[MAX_PLAYERS]; new speedmessage[256]; for (new i = 0; i < MAX_PLAYERS; i++) { GetPlayerPos(i,newpos[i][0],newpos[i][1],newpos[i][2]); speed[i] = floatsqroot(floatpower(newpos[i][0]-oldpos[i][0],2)+floatpower(newpos[i][1]-oldpos[i][1],2))/2.25/0.5*3.6; format(speedmessage,sizeof(speedmessage),"%d km/h",floatround(speed[i],floatround_round)); TextDrawDestroy(gText); gText = TextDrawCreate(10.0, 100.0, speedmessage); TextDrawShowForPlayer(i, gText); oldpos[i][0] = newpos[i][0]; oldpos[i][1] = newpos[i][1]; } }