16.08.2013, 19:59
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf>
#define ERROR_DIALOG 5100
#define Green 0x00FF00FF
enum pDat
{
FPS,
DLlast
}
new PlayerDat[MAX_PLAYERS][pDat],
FPSTimer[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
FPSTimer[playerid] = SetTimerEx("GetPlayerFPS",100,1,"d",playerid);
return 1;
}
CMD:fps(playerid,params[])
{
new player1 = strval(params);
if(sscanf(params,"u",player1))return ShowPlayerDialog(playerid,ERROR_DIALOG+2,DIALOG_STYLE_MSGBOX,"ERROR!","{FFFFFF}[Usage]:- {EA0000}/fps [playerid]","Ok","");
if(!IsPlayerConnected(player1))return SendClientMessage(playerid,0xFF0000FF,"[ERROR]:- {FFFFFF}Player Not Connected!");
new string[256];
format(string,sizeof(string),"PlayerName: {FFFFFF}%s[%d] , {00F311}FPS:- {FFFFFF}%d",pName(player1),player1,GetPlayerFPS(player1));
SendClientMessage(playerid,Green,string);
return 1;
}
forward GetPlayerFPS(playerid);
public GetPlayerFPS(playerid)
{
new drunk2 = GetPlayerDrunkLevel(playerid);
if(drunk2 < 100)
{
SetPlayerDrunkLevel(playerid,2000);
}
else
{
if(PlayerDat[playerid][DLlast] != drunk2)
{
new fps = PlayerDat[playerid][DLlast] - drunk2;
if((fps > 0) && (fps < 200))
PlayerDat[playerid][FPS] = fps;
PlayerDat[playerid][DLlast] = drunk2;
}
}
return PlayerDat[playerid][FPS];
}
stock pName(playerid)
{
new name[24];
GetPlayerName(playerid,name,sizeof(name));
return name;
}