28.12.2010, 23:55
How would I go on about and make a textdraw that shows the ping in white on a player? (Their ping on their body)
new ping, text[12];
ping = GetPlayerPing(playerid);
format(text, sizeof(text), "Ping: %d", ping);
label[playerid] = Create3DTextLabel(text, 0x008080FF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
for(i=0; i<MAX_PLAYERS, i++)
{
new ping, text[12];
ping = GetPlayerPing(i);
format(text, sizeof(text), "Ping: %d", ping);
Update3DTextLabelText(label[i], 0xFFFFFFFF, text);
}
new Text3D:ping;
forward updater(playerid);
public OnFilterScriptInit()
{
ping = Create3DTextLabel("Ping: %d",0xFFFFFFFF, 0.0, 0.0, 0.0, 100, 0, 1);
return 1;
}
public OnPlayerSpawn(playerid)
{
Attach3DTextLabelToPlayer(ping, playerid, 0.0, 0.0, 0.0);
SetTimerEx("updater",1000,false,"i",playerid);
return 1;
}
public updater(playerid)
{
new string[128];
format(string,sizeof(string),"Ping: %d",GetPlayerPing(playerid));
Update3DTextLabelText(ping, 0xFFFFFFFF, string);
return 1;
}
pawn Код:
|