11.04.2012, 18:42
Bom Pesquisei aki na Forum Samp Todos q Achei n Funciona queria q se alguem podesse fazer um bem simples mostrando o fps em baixo do mapa
Obrigado..
Obrigado..
#include <a_samp>
new Text:FPS[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
FPS[playerid] = TextDrawCreate(240.0, 580.0, "FPS: Carregando");
TextDrawShowForPlayer(playerid, FPS[playerid]);
return 1;
}
public OnPlayerUpdate(playerid)
{
new string[128];
format(string, sizeof(string), "Your FPS: %d", GetPlayerFPS(playerid));
TextDrawSetString(FPS[playerid], string);
return 1;
}
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;
}
#include <a_samp>
new Text: textFPS[MAX_PLAYERS];
new Text:FPS[MAX_PLAYERS];
new DLlast[MAX_PLAYERS];
new FPS2[MAX_PLAYERS];
public OnPlayerDisconnect(playerid, reason)
{
TextDrawDestroy(FPS[playerid]);
return 1;
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid,FPS[playerid]);
return 1;
}
public OnFilterScriptInit()
{
SetTimer("fpsCheck", 100, true);
for(new i=0; i<MAX_PLAYERS; i++)
{
textFPS[i] = TextDrawCreate(199.000000, 375.000000, " ");
TextDrawAlignment(textFPS[i], 3);
TextDrawBackgroundColor(textFPS[i], 0xFF8000FF);
TextDrawFont(textFPS[i], 3);
TextDrawLetterSize(textFPS[i], 0.389999, 0.899999);
TextDrawColor(textFPS[i], 0x000000f6);
TextDrawSetOutline(textFPS[i], 1);
TextDrawSetProportional(textFPS[i], 1);
}
return 1;
}
public OnPlayerUpdate(playerid)
{
new drunk2 = GetPlayerDrunkLevel(playerid);
if(drunk2 < 100)
{
SetPlayerDrunkLevel(playerid,2000);
}
else
{
if(DLlast[playerid] != drunk2)
{
new fps = DLlast[playerid] - drunk2;
if((fps > 0) && (fps < 200))
FPS2[playerid] = fps;
DLlast[playerid] = drunk2;
}
}
return 1;
}
forward fpsCheck();
public fpsCheck()
{
for(new i; i != GetMaxPlayers(); ++i)
{
if(IsPlayerConnected(i) && !IsPlayerNPC(i))
{
if(GetPVarInt(i, "spawned"))
{
SetPVarInt(i, "drunkLevel", GetPlayerDrunkLevel(i));
if(GetPVarInt(i, "drunkLevel") < 100)
{
SetPlayerDrunkLevel(i, 2000);
}
else
{
if(GetPVarInt(i, "lastDrunkLevel") != GetPVarInt(i, "drunkLevel"))
{
SetPVarInt(i, "fps", (GetPVarInt(i, "lastDrunkLevel") - GetPVarInt(i, "drunkLevel")));
SetPVarInt(i, "lastDrunkLevel", GetPVarInt(i, "drunkLevel"));
if((GetPVarInt(i, "fps") > 0) && (GetPVarInt(i, "fps") < 256))
{
new string[24];
format(string, sizeof(string),"FPS: %d", GetPVarInt(i, "fps") - 1);
TextDrawSetString(textFPS[i], string);
TextDrawShowForPlayer(i, textFPS[i]);
}
}
}
}
else
{
TextDrawHideForPlayer(i, textFPS[i]);
}
}
}
return 1;
}
#include <a_samp>
new Text:fpstext1[MAX_PLAYERS];
new pFPS[MAX_PLAYERS];
new pDrunkLevelLast[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid,fpstext1[playerid]);
return 1;
}
public OnFilterScriptInit()
{
for(new i, k = GetMaxPlayers(); i != k; ++i)
{
fpstext1[i] = TextDrawCreate(60.000000, 323.000000, "FPS");
TextDrawBackgroundColor(fpstext1[i], -16776961);
TextDrawFont(fpstext1[i], 3);
TextDrawLetterSize(fpstext1[i], 0.500000, 1.200000);
TextDrawColor(fpstext1[i], -16776961);
TextDrawSetOutline(fpstext1[i], 0);
TextDrawSetProportional(fpstext1[i], 1);
TextDrawSetShadow(fpstext1[i], 0);
}
return 1;
}
public OnPlayerUpdate(playerid)
{
new drunknew;
drunknew = GetPlayerDrunkLevel(playerid);
if (drunknew < 100) { // go back up, keep cycling.
SetPlayerDrunkLevel(playerid, 2000);
} else {
if (pDrunkLevelLast[playerid] != drunknew) {
new wfps = pDrunkLevelLast[playerid] - drunknew;
if ((wfps > 0) && (wfps < 200))
pFPS[playerid] = wfps;
pDrunkLevelLast[playerid] = drunknew;
}
}
new stringtextdraw[200];
format(stringtextdraw, sizeof(stringtextdraw),"Fps: %i",GetPlayerFPS(playerid));
TextDrawSetString(fpstext1[playerid],stringtextdraw);
return 1;
}
stock GetPlayerFPS(playerid) return pFPS[playerid];
#include <a_samp>
new TimerFPS[MAX_PLAYERS];
new Text:FPS[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
FPS[playerid] = TextDrawCreate(577.000000, 9.000000, "FPS: Carregando");
TextDrawBackgroundColor(FPS[playerid], 255);
TextDrawFont(FPS[playerid], 1);
TextDrawLetterSize(FPS[playerid], 0.209999, 1.400000);
TextDrawColor(FPS[playerid], -1);
TextDrawSetOutline(FPS[playerid], 0);
TextDrawSetProportional(FPS[playerid], 1);
TextDrawSetShadow(FPS[playerid], 1);
TextDrawShowForPlayer(playerid, FPS[playerid]);
TimerFPS[playerid] = SetTimerEx("AtualizarFPS", 1000, true, "i", playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
switch(reason)
{
case 0..2: KillTimer(TimerFPS[playerid]);
}
return 1;
}
forward AtualizarFPS(playerid);
public AtualizarFPS(playerid)
{
new string[128];
format(string, sizeof(string), "Seu FPS: %d", GetPlayerFPS(playerid));
TextDrawSetString(FPS[playerid], string);
return 1;
}
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;
}
Vlw Paulor Funciono Como q eu Mudo a Cor, tipo e o lugar da letra?
|
Mesma coisa, os 2 sгo pra inteiros...
@Edit Tente esse... pawn Код:
|
public OnPlayerConnect(playerid)
{
FPS[playerid] = TextDrawCreate(577.000000, 9.000000, "FPS: Carregando"); //COORDENADAS DA TELA
TextDrawBackgroundColor(FPS[playerid], 255);
TextDrawFont(FPS[playerid], 1); //TIPO
TextDrawLetterSize(FPS[playerid], 0.209999, 1.400000);
TextDrawColor(FPS[playerid], -1); //COR
TextDrawSetOutline(FPS[playerid], 0);
TextDrawSetProportional(FPS[playerid], 1);
TextDrawSetShadow(FPS[playerid], 1);
TextDrawShowForPlayer(playerid, FPS[playerid]);
TimerFPS[playerid] = SetTimerEx("AtualizarFPS", 1000, true, "i", playerid);
return 1;
}
public OnPlayerConnect(playerid)
{
FPS[playerid] = TextDrawCreate(577.000000, 9.000000, "FPS: Carregando");//Coordenadas X, Y.
TextDrawBackgroundColor(FPS[playerid], 255);
TextDrawFont(FPS[playerid], 1);
TextDrawLetterSize(FPS[playerid], 0.209999, 1.400000);
TextDrawColor(FPS[playerid], -1);//Cor Texto - 0x000000FF(Preto), 0xFF0000FF(Vermelho), 0x00FF00FF(Verde), 0x0000FFFF(Azul), 0xFFFFFFFF(Branco).
TextDrawSetOutline(FPS[playerid], 0);
TextDrawSetProportional(FPS[playerid], 1);
TextDrawSetShadow(FPS[playerid], 1);
TextDrawShowForPlayer(playerid, FPS[playerid]);
TimerFPS[playerid] = SetTimerEx("AtualizarFPS", 1000, true, "i", playerid);
return 1;
}