how can i getting player ping

Posts 1–15 of 18 · Page 1 of 2
how can i getting player ping
hi guys,

1.
can u tell me how to get player's ping (latency)
or Self ping.

2.
how can i make console commands
eg. when i costume command in the console say

changenextgame "mp_rust" "sd"

it should run my function in my mod
i.e.
changenextgame(nextmap, nexttype)
{
setDvar("sv_maprotation", "gametype " + nextmap + " map " + nexttype + " " + getDvar("sv_maprotation"));
}

Regards
1) You can't get a players ping via a function, as I know.

2) Custom functions won't be recognized by the console. What you can do though is make a function that reads the custom variable and set the other one manually, if you get what I mean
Quote Originally Posted by Boon Pek View Post
1) You can't get a players ping via a function, as I know.

2) Custom functions won't be recognized by the console. What you can do though is make a function that reads the custom variable and set the other one manually, if you get what I mean
Thanks for replying

but
1) can u tell me the function name to get the ping

2) how do i declare custom variable
level.nextmap = "mp_rust" (didnt work)
or self.nextmap = "mp_rust"
or some other
i thought it was like " + self.ping + "
Quote Originally Posted by jimmynguyen3030 View Post
i thought it was like " + self.ping + "
epic fail.
Quote Originally Posted by master131 View Post
epic fail.
lol hahaha

cuz self.GUID works self.maxhealth works self.name works so...
1) there is not a function (in game func, ofc) to get a player's ping.
2) level.nextmap does indeed set a custom variable a global variable called nextmap
Quote Originally Posted by Boon Pek View Post
1) there is not a function (in game func, ofc) to get a player's ping.
2) level.nextmap does indeed set a custom variable a global variable called nextmap
1) so ther any way i can get player ping to my mod

2) level.nextmap is not accessible from console
i mean a like Dvar g_gametype "war"
How can Create a Dvar which is accessible from console

Regards.
If I remember right, it has something with
setDvarIfUnitialized("", );

Can't really remember.
Quote Originally Posted by Arasonic View Post
If I remember right, it has something with
setDvarIfUnitialized("", );

Can't really remember.
Not working
tryed
setDvarIfUnitialized("nextname", "");
self setDvarIfUnitialized("nextname", "");

Error "UnKnown Command"
Code:
if( getDvar("varnamehere") == "value" )
{
	execute code;
}
That'd work. Like... if this Dvar is not the same as previous setting, then change the next map rotation to this etc...
setDvarIfUnitialized("nextname", "");
self setDvarIfUnitialized("nextname", "");
Actuatly if i add any 1 these line to init() & try to load that mod i get error "Unknown command"
setDvarIfUnitialized isn't a function in MW2, which is why it does not work.
^
|
Wrong, just me that might say some wrong typos.
Heres an example

Code:
newConsoleDvar()
{
        SetDvarIfUninitialized( "thing", "none");
        self endon ( "death" );
        for(;;)
        {
		if(getdvar( "thing" ) == "the "none" value here"){
		        //code here
		    }
        }
}
Code:
newConsoleDvar()
{
        SetDvarIfUninitialized( "giveM9", "none");
        self endon ( "death" );
        for(;;)
        {
		if(getdvar( "giveM9" ) == "1"){
		self giveWeapon("beretta_mp");}
        }
}

giveM9 1
Add it to onPlayerSpawned, and then type in console
Untested, but should most likely work
If it doesn't work, but doesn't give an error itself, try a devmap
Posts 1–15 of 18 · Page 1 of 2
This thread is closed for replies.

Tags for this Thread

Talk with us