13.10.2012, 21:27
Hello ladies,this command sometimes returns 0 when checking the FPS of a player:
GetPlayerFps
I've to type like 5-6 times to get the current player FPS otherwise it will return me: FPS: 0
Any tip?
pawn Код:
CMD:fps(playerid,params[])
{
new Target;
if(sscanf(params, "u", Target)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /fps [playerid]");
if(!sscanf(params, "u", Target))
if(Target == INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"Error: Wrong player ID");
new pstring[128];
new tname[MAX_PLAYER_NAME];
GetPlayerName(Target,tname,sizeof(tname));
format(pstring,sizeof(pstring),"%sґs FPS: %d",tname, GetPlayerFps(Target));
SendClientMessage(playerid,COLOR_YELLOW,pstring);
return 1;
}
pawn Код:
stock GetPlayerFps(playerid)
{
SetPVarInt(playerid, "DrunkL", GetPlayerDrunkLevel(playerid));
if(GetPVarInt(playerid, "DrunkL") < 100) SetPlayerDrunkLevel(playerid, 2000);
else{
if(GetPVarInt(playerid, "LDrunkL") != GetPVarInt(playerid, "DrunkL"))
{
SetPVarInt(playerid, "FPS", (GetPVarInt(playerid, "LDrunkL") - GetPVarInt(playerid, "DrunkL")));
SetPVarInt(playerid, "LDrunkL", GetPVarInt(playerid, "DrunkL"));
if((GetPVarInt(playerid, "FPS") > 0) && (GetPVarInt(playerid, "FPS") < 256))
{
return GetPVarInt(playerid, "FPS") - 1;
}
}
}
return 0;
}
Any tip?