GetPlayerFPS + another question
#1

'Sup y'all scripters?

I've always wondered, how servers are receiving the information of a player's FPS! My destination is to get the player's FPS and display it for him the as a small textdraw in the right corner! Since I never worked with textdraws, any help in this case would be appreciated, too!

The other question is really simple: What would be the best way to make a synchronize-command? ( /s )
Shall I just set the position of the player? The reason of this command is because many players are getting carparked, and with such a command, they could escape!
Reply
#2

I'd need this function as soon as possible, so any help would be appreciated! Usually I don't bump stuff that early, but it's really important right now!
Reply
#3

https://sampforum.blast.hk/showthread.php?tid=172202
Reply
#4

There is written that it only works with 0.3b, so will I be able to use it now? By the way, the FPS should only be displayed in the left corner at the bottom, so which part of the textdraws would remove the one in the upper right corner?
Reply
#5

Quote:
Originally Posted by Twisted_Insane
Посмотреть сообщение
There is written that it only works with 0.3b, so will I be able to use it now? By the way, the FPS should only be displayed in the left corner at the bottom, so which part of the textdraws would remove the one in the upper right corner?
It was written because back then 0.3b was the newest version out, I meant that it won't work on versions OLDER than 0.3b.
I can't promise that it will work, maybe you need to recompile it.

And the one on the upper right corner is Fraps, I only used it to insure that my script is as accurate as Fraps.
Reply
#6

I simlpy will use your pastebin, okay? And the "for-loop" under "OnFilterscriptInit", I should add to my "OnGameModeInit", right?
Reply
#7

Quote:
Originally Posted by Twisted_Insane
Посмотреть сообщение
I simlpy will use your pastebin, okay? And the "for-loop" under "OnFilterscriptInit", I should add to my "OnGameModeInit", right?
If it's a gamemode, yes.
Reply
#8

Well look, I'm getting a few errors:

Quote:

D:\Program Files\GTA San Andreas\SAMP_Server\gamemodes\deathmatch.pwn(1341) : warning 225: unreachable code
D:\Program Files\GTA San Andreas\SAMP_Server\gamemodes\deathmatch.pwn(2256) : error 017: undefined symbol "string"
D:\Program Files\GTA San Andreas\SAMP_Server\gamemodes\deathmatch.pwn(2256) : error 017: undefined symbol "string"
D:\Program Files\GTA San Andreas\SAMP_Server\gamemodes\deathmatch.pwn(2256) : error 029: invalid expression, assumed zero
D:\Program Files\GTA San Andreas\SAMP_Server\gamemodes\deathmatch.pwn(2256) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

I never defined a string here:

pawn Код:
forward FPSUP();
public FPSUP()
{
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                format(string,sizeof(string),"FPS: %d",FPS2[i]-1); //here
                        TextDrawSetString(FPS[i],string); //here
                }
                continue;
        }
}
Not sure where I should have had put it...

Also, is this okay under "OnGameModeInit"?

pawn Код:
public OnGameModeInit() {
   
    //other stuff
        for(new i=0; i < sizeof(ZoneInfo); i++)
        {
            ZoneID[i] = GangZoneCreate(ZoneInfo[i][zMinX], ZoneInfo[i][zMinY], ZoneInfo[i][zMaxX], ZoneInfo[i][zMaxY]);
        }
       
//////here is your's
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            FPS[i] = TextDrawCreate(8.000000, 428.000000, "FPS: 30");
            TextDrawBackgroundColor(FPS[i], 255);
            TextDrawFont(FPS[i], 3);
            TextDrawLetterSize(FPS[i], 0.480000, 2.000000);
            TextDrawColor(FPS[i], -65281);
            TextDrawSetOutline(FPS[i], 1);
            TextDrawSetProportional(FPS[i], 1);
        }
        SetTimer("FPSUP",1203,true);
        return 1;
       
        DisableInteriorEnterExits();
        //rest of callback
Reply
#9

Add:
pawn Код:
new string[24];
To the top of your script.
Reply
#10

Now I get this strange warning:

Код:
D:\Program Files\GTA San Andreas\SAMP_Server\gamemodes\deathmatch.pwn(1342) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
This wasn't before under OnGameModeInit:

pawn Код:
public OnGameModeInit() {
   
    //other stuff
        for(new i=0; i < sizeof(ZoneInfo); i++)
        {
            ZoneID[i] = GangZoneCreate(ZoneInfo[i][zMinX], ZoneInfo[i][zMinY], ZoneInfo[i][zMaxX], ZoneInfo[i][zMaxY]);
        }
       
//from here, yours begins
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            FPS[i] = TextDrawCreate(8.000000, 428.000000, "FPS: 30");
            TextDrawBackgroundColor(FPS[i], 255);
            TextDrawFont(FPS[i], 3);
            TextDrawLetterSize(FPS[i], 0.480000, 2.000000);
            TextDrawColor(FPS[i], -65281);
            TextDrawSetOutline(FPS[i], 1);
            TextDrawSetProportional(FPS[i], 1);
        }
        SetTimer("FPSUP",1203,true);
        return 1;
       
        DisableInteriorEnterExits(); //here is the warning, never happened before
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)