PDA

View Full Version : COD4 : getting clients com_maxfps questions



se891
12th April 2016, 01:01
Hello :)


i'm trying to display the fps of the player that you're spectating in COD4 cj mod as you know most jumps takes many fps switches and different Technics
so this will benefit every cj player in the server
example :

1091


my questions are the following :

1- can getUserInfo("com_maxfps") be used without Clientcmd menu ? and if possible how ?

2- is there any source for COD4 CJ mod or a CJ MOD with clientmenu already in it ?

3- is there any other way to get client fps ?

4- unrelated question any one by any change have the speedometer script (the numbers showing in the bottom of the photo are the curent speed which is changing and the max speed reached which changes only if you reach a higher speed then you did before ) ?

running 1.7a win64

thanks :)

se891
8th May 2016, 11:13
hello ? is this forum alive ?

Mitch
8th May 2016, 12:53
There are already two threads about this:

https://killtube.org/showthread.php?1632-Show-FPS-in-Hud

However this one won't work with 1.7a, because you can't run libcod and 1.7a together.
https://killtube.org/showthread.php?2192-Getting-a-client-s-real-fps-realtime

Edit:

4- unrelated question any one by any change have the speedometer script (the numbers showing in the bottom of the photo are the curent speed which is changing and the max speed reached which changes only if you reach a higher speed then you did before ) ?

Something like this?

calculatePlayerSpeed() {
speed = distance(self.origin, self.previousorigin); // or DistanceSquared (= cheaper/faster function)
self.previousorigin = self.origin;
return speed;
}
Call this every frame (or in the same time interval) then you will get the distance between current origin and previous origin.

IzNoGoD
8th May 2016, 12:58
You know that thread you linked by me got inspired by stuff inside cod4x...

Better to just getuserinfo() the stuff with setu

se891
9th May 2016, 06:04
There are already two threads about this:

https://killtube.org/showthread.php?1632-Show-FPS-in-Hud

However this one won't work with 1.7a, because you can't run libcod and 1.7a together.
https://killtube.org/showthread.php?2192-Getting-a-client-s-real-fps-realtime

Edit:


Something like this?

calculatePlayerSpeed() {
speed = distance(self.origin, self.previousorigin); // or DistanceSquared (= cheaper/faster function)
self.previousorigin = self.origin;
return speed;
}
Call this every frame (or in the same time interval) then you will get the distance between current origin and previous origin.

thnx for the speedometer

as for the threads about fps .. those won't work for cod4

se891
9th May 2016, 06:06
You know that thread you linked by me got inspired by stuff inside cod4x...

Better to just getuserinfo() the stuff with setu

no one uses setu meaning it won't show the fps for most if not all the users in the server
it can be done without clientcmd menu but i have no idea how and i'm losing my mind over it

the server in the screenshot i provided with the post is from 3xp Codjumper server .. thier mod doesn't have clientcmd.menu and still displays players fps no problems
i tried to buy the full mod even tried to buy the stock codjumper source files to added clientcmd.menu and other features and no one willing to even reply
after hours of searching this is the only active fourm i found with people that know what they're talking about and willing to help

so you're my last hope

se891
10th May 2016, 12:06
You know that thread you linked by me got inspired by stuff inside cod4x...

Better to just getuserinfo() the stuff with setu

let me explain more

getuserinfo will work if the client uses setu com_maxfps or the server forces the client to do setu com_maxfps when the client connects to the server
i don't know of any other way to do setu than using clientcmd menu which will look like this

player clientcmd("setu com_maxfps 250" );

is there other way to do setu com_maxfps in onconnectplayer() without clientcmd ?

thanks :)

IzNoGoD
10th May 2016, 12:53
why not just do something like this?


player clientcmd("setfromdvar temp com_maxfps; setu com_maxfps 124; wait 1; setu com_maxfps 125; wait 1; setfromdvar com_maxfps temp");

se891
10th May 2016, 13:05
why not just do something like this?


player clientcmd("setfromdvar temp com_maxfps; setu com_maxfps 124; wait 1; setu com_maxfps 125; wait 1; setfromdvar com_maxfps temp");


clientcmd requiers the mod to have clientcmd.menu compiled in it
the problem cod jumper doesn't have that menu
which is why i was asking can you do it WITHOUT clientcmd menu

se891
10th May 2016, 13:09
Something like this?

calculatePlayerSpeed() {
speed = distance(self.origin, self.previousorigin); // or DistanceSquared (= cheaper/faster function)
self.previousorigin = self.origin;
return speed;
}
Call this every frame (or in the same time interval) then you will get the distance between current origin and previous origin.

can you make the script show the speed without the tenths
meaning if my speed is 534.03431 i want it to show 543 only since the tenths don't matter

thanks

voron00
10th May 2016, 13:22
can you make the script show the speed without the tenths
meaning if my speed is 534.03431 i want it to show 543 only since the tenths don't matter

thanks


calculatePlayerSpeed() {
speed = int(distance(self.origin, self.previousorigin)); // or DistanceSquared (= cheaper/faster function)
self.previousorigin = self.origin;
return speed;
}

thOuMta
10th May 2016, 17:39
I trying too and only get FPS: 0



onStartGametype()
{
precacheMenu("clientcmd");
}

onPlayerSpawned()
{
if(!self.cj["spawned"])
{
self thread [[level.onPlayerStartedMap]]();
self.cj["spawned"] = true;
self.cj["save"]["org0"] = self getOrigin();
self.cj["save"]["ang0"] = self getPlayerAngles();
wait 0.05;
self execClientCommand("setfromdvar temp0 com_maxfps; setu com_maxfps 125; setfromdvar com_maxfps temp0");
}

}
execClientCommand(cmd)
{
self endon("disconnect");

self setClientDvar( "clientcmd", cmd );
self openMenuNoMouse("clientcmd");
}

getMaxFPS()
{
self endon("disconnect");
return int(min(1000,int(self [[level.getUserInfo]]("com_maxfps"))));
}

updateInfoHud()
{
self.cj["maxfps"] = self getMaxFPS();
self.cj["hud"]["info"]["maxfps"] setValue(self.cj["maxfps"]);

self.deaths = self.cj["maxfps"];
}

hudfps()
{
if(!isDefined(self.cj["hud"]["info"]))
{
self.cj["hud"]["info"]["maxfps"] = createFontString( "default", 1.4 );
self.cj["hud"]["info"]["maxfps"] setPoint( "RIGHT", "TOPRIGHT", -10, 100 );
self.cj["hud"]["info"]["maxfps"].hideWhenInMenu = true;
self.cj["hud"]["info"]["maxfps"].archived = true;
self.cj["hud"]["info"]["maxfps"].alpha = 0;
self.cj["hud"]["info"]["maxfps"].label = &"FPS: &&1";
}

info = self.cj["hud"]["info"];
hudarray = getArrayKeys(info);
for(i = 0 ; i < hudarray.size; i++)
{
info[hudarray[i]] fadeOverTime(2);
info[hudarray[i]].alpha = 1;
}

self thread updateInfoHud();
}

///////////////////////////////////////////////////////
clientcmd.menu
///////////////////////////////////////////////////////

#include "ui/menudef.h"

{
menuDef
{
name "clientcmd"
rect 0 0 1 1
visible 0
fullscreen 0

onOpen
{
exec "vstr clientcmd";
close clientcmd;
}
}
}


i don't know how :)