05.02.2014, 18:45
Well, I've been trying to create a command like "/enableinfo" etc..
It seems to work, but it does the opposite.
I want it to show the PLAYER (who typed the command) other player fps/ping etc, but it shows the writers/players fps/ping to everyone else
The code:
It seems to work, but it does the opposite.
I want it to show the PLAYER (who typed the command) other player fps/ping etc, but it shows the writers/players fps/ping to everyone else
The code:
pawn Код:
new updatething[MAX_PLAYERS];
CMD:enableinfo(playerid, params[]) {
new string[102], ping;
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_RED, "[ADMIN] - You're not a high enough level to use this command!");
for(new i = 0; i < MAX_PLAYERS; i++)
{
new drunk2 = GetPlayerDrunkLevel(i);
new fps = DLlast[i] - drunk2;
if((fps > 0) && (fps < 200))
FPS2[i] = fps;
DLlast[i] = drunk2;
ping = GetPlayerPing(i);
format(string, sizeof(string), "FPS: %d\nPING: %d", FPS2[i]-1, ping);
labelss[i] = Create3DTextLabel(string, 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0, 1);
Attach3DTextLabelToPlayer(labelss[i], i, 0.0, 0.0, 0.47);
updatething[i] = SetTimer("UpdateTimer", 1500, true);
}
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(string, sizeof(string), "* Admin %s[%d] has enabled player info! Now you will see other player FPS/PING", name, playerid);
SendClientMessageToAll(COLOR_GREEN, string);
return 1;
}
forward UpdateTimer();
public UpdateTimer()
{
new ping, string[28];
for(new i = 0; i < MAX_PLAYERS; i++)
{
new drunk2 = GetPlayerDrunkLevel(i);
new fps = DLlast[i] - drunk2;
if((fps > 0) && (fps < 200))
FPS2[i] = fps;
DLlast[i] = drunk2;
ping = GetPlayerPing(i);
format(string, sizeof(string), "FPS: %d\nPING: %d", FPS2[i]-1, ping);
UpdatePlayer3DTextLabelText(i,PlayerText3D:labelss[i],0x008080FF, string);
}
return 1;
}
CMD:disableinfo(playerid, params[]) {
new string[102];
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_RED, "[ADMIN] - You're not a high enough level to use this command!");
for(new i = 0; i < MAX_PLAYERS; i++)
{
Delete3DTextLabel(labelss[i]);
KillTimer(updatething[i]);
}
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(string, sizeof(string), "* Admin %s[%d] has disabled player info! You will no longer see other player FPS/PING", name, playerid);
SendClientMessageToAll(COLOR_RED, string);
return 1;
}