FPS textdraw
#1

Hi all,is possible to have the FPS textdraw like this:



?

I already know how to create textdraw,but how updating with TextdrawSetString?

Thanks.
Reply
#2

pawn Код:
new Text:FPS[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    FPS[playerid] = TextDrawCreate(240.0, 580.0, "Your FPS: Loading");
   
    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;
}
Reply
#3

Love you.
Reply
#4

or can also:
pawn Код:
public OnPlayerConnect( playerid )
{
   FPS[ playerid ] = TextDrawCreate( 240.0, 580.0, "Your FPS: Loading" );
   TextDrawShowForPlayer( playerid, FPS[ playerid ] );
   SetTimerEx( "@tKnight", 500, false, "i", playerid );
   return true;
}

forward @tKnight( playerid );
public @tKnight( playerid )
{
   new
         sStr[ 128 ];  
   format( sStr, sizeof( sStr ), "Your FPS: %d", GetPlayerFPS( playerid ) );  
   TextDrawSetString( FPS[ playerid ], sStr );
   return true;
}
Reply
#5

Quote:
Originally Posted by CyberGhost
Посмотреть сообщение
pawn Код:
new Text:FPS[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    FPS[playerid] = TextDrawCreate(240.0, 580.0, "Your FPS: Loading");
   
    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;
}
Why such a big string size, it's only about 20 (or less) characters long -_-

pawn Код:
public OnPlayerUpdate(playerid)
{
    new string[20];
    format(string, sizeof(string), "Your FPS: %d", GetPlayerFPS(playerid));
    TextDrawSetString(FPS[playerid], string);
    return 1;
}
I recognize that textdraw btw, it's from Los Santos Gang Wars (LSGW)
Reply
#6

PotH3Ad get it .That server is awesome.
Reply
#7

Why not just use a 1second timer?
Reply
#8

it uses a 4 second timer on lsgw if you're interested. but even increasing to 10 or 20 seconds wouldn't cause much harm.
Reply
#9

whats the GetPlayerFPS function from i need it!
Reply
#10

Quote:
Originally Posted by sciman001
Посмотреть сообщение
whats the GetPlayerFPS function from i need it!
JernejL's post from Scripting Tutorials I think.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)