11.01.2014, 20:26
Hello,
i want to make this player fps for can active & disable with command /pfp here is code
i want to make this player fps for can active & disable with command /pfp here is code
pawn Код:
#include <a_samp>
enum PlayerVariables
{
DLlast,
FPS
}
new Player[MAX_PLAYERS][PlayerVariables];
new Text3D:PingFPS[MAX_PLAYERS];
public OnGameModeInit()
{
SetTimer("FPSupdate", 1000, true);
return 1;
}
public OnPlayerConnect(playerid)
{
PingFPS[playerid] = Create3DTextLabel("_", 0x00FF00FF, 0, 0, 0, 10.0, 0, 1);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
Delete3DTextLabel(PingFPS[playerid]);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return 0;
}
forward FPSupdate();
public FPSupdate()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
GetPlayerFPS(i);
new iString[256];
new pPing = GetPlayerPing(i);
format(iString, sizeof(iString), "Ping: {FFFFFF}%i\nFPS: {FFFFFF}%i", pPing, Player[i][FPS]);
Update3DTextLabelText(PingFPS[i], 0x00FF00FF, iString);
Attach3DTextLabelToPlayer(PingFPS[i], i, 0.0, 0.0, -0.745);
}
}
stock GetPlayerFPS(playerid)
{
new drunk2 = GetPlayerDrunkLevel(playerid);
if(drunk2 < 100){
SetPlayerDrunkLevel(playerid,2000);
}else{
if(Player[playerid][DLlast] != drunk2){
new fps = Player[playerid][DLlast] - drunk2;
if((fps > 0) && (fps < 200))
Player[playerid][FPS] = fps;
Player[playerid][DLlast] = drunk2;
}
}
}