11.07.2012, 10:32
At top add
pawn Код:
new Text:vSpeed[MAX_PLAYERS];
new uSpeed[MAX_PLAYERS];
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vString[128];
format(vString,sizeof(vString),"Speed:%d",GetPlayerSpeed(playerid));
TextDrawSetString(vSpeed[playerid],vString);
TextDrawShowForPlayer(playerid,vSpeed[playerid]);
uSpeed[playerid] = SetTimerEx("UpdateSpeed",1000,true,"i",playerid);
if(oldstate == PLAYER_STATE_DRIVER&&newstate==PLAYER_STATE_ONFOOT)
{
TextDrawHideForPlayer(playerid,vSpeed[playerid]);
KillTimer(uSpeed[playerid]);
}
}
}
pawn Код:
public OnGameModeInit()
{
for(new i=0;i<MAX_PLAYERS;++i)
{
vSpeed[i] = TextDrawCreate(x,y,"_");//Replace X,Y with coordinates.
TextDrawAlignment(vSpeed[i],3);
TextDrawColor(vSpeed[i],COLOR_WHITE);
TextDrawFont(vSpeed[i],0);
}
return 1;
}