PDA

View Full Version : Quick questions thread



IzNoGoD
28th December 2012, 15:04
Here is a thread where you can quickly ask a simple question.
Dont ask questions that might need a lot of explaining, just the simpler ones

Ill open with one I received on xf:

[14:36] F |Madness| U: hey again, don't suppose you know of a way to use getEntArray() to get all the scripted entities on a map?
[14:36] F |Madness| U: I tried getEntArray( "*", "targetname" )
[14:36] F |Madness| U: cause I thought it might take * as a wildcard but it doesn't

Answer:
Just call getentarray() to get all entities in a map (everything will be there). Filter afterwards if required.

EvoloZz
28th December 2012, 15:32
Is there a way to use "/rcon say" inside scripts, i mean instead of iprintlnbold it would say what you want in chat with console? For example "console: Player #1 got pwned by Player #2"

IzNoGoD
28th December 2012, 16:22
Not yet.

If im correct, kung is desperately trying to get something like that to work, but it will only work on killtube-hosted servers.

EvoloZz
28th December 2012, 17:50
Ok , and one question, I've been punching my head against the wall, already for some time.
So i have tried to make some kinda music menu for quickmessage menu, and it works (somehow). The main problem is that the sounds are not local, i mean all players will hear the music or sounds. But after i tried to use some function that actually made the sound "local", but then weapon sound overrides it, if i shoot the music stops, which is kinda annoying.
I used this function:

if(isPlayer(self))
{
self playlocalSound("spawn");
}
That is supposed to play some Black Ops spawn music when player joins and spawns, but if he shoots with his weapon, it will stop the sound.
And I have also tried some other functions, but then everyone will hear the music. What causes the main problem? Maybe it is soundalias? or just the function sucks?
The soundalias is like this:

spawn,,other/spawn.mp3,1.0,,,,,,,local,streamed,,nonlooping
I hope someone got fix for this
I can make separate topic for this problem if this problem needs lots of explaining

IzNoGoD
28th December 2012, 17:56
Soundalias
Set channel to auto or to announcer.

EvoloZz
28th December 2012, 18:52
With auto i cannot hear anything, and announcer works but the sounds can corrupt each other

kung foo man
28th December 2012, 19:19
Not yet.

If im correct, kung is desperately trying to get something like that to work, but it will only work on killtube-hosted servers.

Im not desperately trying it, the research is basically already done. Just would need to implement the function for every cod2-version.

But i am a bit demotivated about the situation, that nobody seems to have any interest on the extra-functions PLUS want to rent a server...

EvoloZz
30th December 2012, 16:22
I am still kinda experiencing problems with it, because what I want is that only one player can hear the sounds, and that you can play all of them in the same time, so first sound doesn't stop second. And I have seen in some mods the channel is music and it is locally, but it didn't work for me :/

serthy
30th September 2016, 10:51
Is there a libcod replacement for execClientCommand() ?

maxdamage99
30th September 2016, 10:55
Is there a libcod replacement for execClientCommand() ?

Now - no, only .menu & script

serthy
5th October 2016, 14:24
When using the libcod getFps() it shows me a number of almost 80-100 frames less than the ingame fps-counter
Am I doing sth wrong or is one of the counters not reliable?

voron00
5th October 2016, 15:35
Make sure you have fpsnextframe() called each frame, in a wait 0.05 loop.

serthy
5th October 2016, 15:42
Make sure you have fpsnextframe() called each frame, in a wait 0.05 loop.

Yep, done as IzNoGoD said in his original thread: https://killtube.org/showthread.php?2192-Getting-a-client-s-real-fps-realtime



Init()
{
level thread MonitorPlayerConnect();
level thread OnFrameUpdate();
}

OnFrameUpdate()
{
while( true )
{
fpsNextFrame();

wait( 0.05 );
}
}

MonitorPlayerConnect()
{
while( true )
{
level waittill( "connected" , player );

if( !isDefined( player ) || !isPlayer( player ) )
continue;

level thread OnClientFrameUpdate( player );
}
}

OnClientFrameUpdate( player )
{
player resetFps();

while( isDefined( player ) )
{
player.fps = player getFps();
player iPrintLn( player.fps );

wait( 0.05 );
}
}

Whiskas
2nd November 2016, 11:47
Can bot record a demo?

voron00
2nd November 2016, 12:00
No. Bots can't do any client commands.

IzNoGoD
2nd November 2016, 17:29
cod4x however has hijacked some of the sendpacket stuff which is used for demo recording. It has preliminary support for server-side demo recording which theoretically should work on bots as well.

However you can just record a demo of a player with it instead, should be easier.

No work has been done to port this to cod2 at this time.

serthy
20th November 2016, 12:58
does sendGameServerCommand( entNum , "h \"text\""); also works for teamchat?
Im using this: https://killtube.org/showthread.php?2077-advanced-Ignoring-text-said-by-certain-players&highlight=mute
but also with "say_team", but it the teamchat is displayed like regular chat-text

NVM, i am being stupid, i just can monitor the team myself and only send the propriate one

IzNoGoD
20th November 2016, 14:07
Keep in mind that you might wanna replace all " by double ' in messages, cause gameservercommands dont know what to do with (even escaped) "-s

Whiskas
18th January 2017, 18:58
NET_SendPacket ERROR: Resource temporarily unavailable to 194.27.72.36:-7108
NET_SendPacket ERROR: Resource temporarily unavailable to 194.27.72.36:-7096
NET_SendPacket ERROR: Resource temporarily unavailable to 194.249.87.231:-4841
NET_SendPacket ERROR: Resource temporarily unavailable to 194.27.72.36:-7161
NET_SendPacket ERROR: Resource temporarily unavailable to 194.27.72.36:-15452
NET_SendPacket ERROR: Resource temporarily unavailable to 194.249.87.231:-4731


What exactly does it says to me? That those IPs were seeking my server, but the response from the server couldn't be delivered?

IzNoGoD
18th January 2017, 20:00
Those ips have shown up as abuse in logs before. Some turkish university doing ddos amp attacks (or receiving them, based on udp amplification)

Don't worry, shouldn't be actual clients.

https://www.abuseipdb.com/check/194.27.72.36
https://www.abuseipdb.com/check/194.249.87.231

Whiskas
14th February 2017, 13:01
Is there a way to print/display a structure of an object (self, level etc.) like it is made for example in PHP (vardump()/print_r()) ?

serthy
14th February 2017, 15:37
Is there a way to print/display a structure of an object (self, level etc.) like it is made for example in PHP (vardump()/print_r()) ?

Not directly: https://killtube.org/showthread.php?2722-Print-any-variable-s-content&p=15105#post15105

Whiskas
14th February 2017, 18:26
Not directly: https://killtube.org/showthread.php?2722-Print-any-variable-s-content&p=15105#post15105

I believe that you misunderstood my question. For example: I used "magic function" on player object and I would like to get back something like this:


Object (
[name] => "Whiskas"
[pers] => Array
(
[team] => "spectator"
[weapon] => undefinded
[savedmodel] => undefined
[skipserverinfo] => undefined
)
[score] => 6
[death] => 2
[sessionstate] => "playing"
[maxhealth] => 100
[health] => 100
[friendlydamage] => undefined
[statusicon] => ""
)


But with every variable that is "binded" to that structure. I would like to know what variables does level/player have.

serthy
14th February 2017, 18:52
Ahh, got it

iirc libcod also has GetArrayKeys() implemented, that works like the CoD4 version (see script reference for that) but this would work only for arrays, not objects..)

guiismiti
21st March 2017, 19:13
How can I print a precached string?

I have this on Callback_StartGameType()


game["spawnprotection"] = &"^2Spawn protection ^1OFF^7";
precacheString(game["spawnprotection"]);

And I'm trying to print it like this


self iprintln(game["spawnprotection"]);

Lonsofore
21st March 2017, 23:28
How can I print a precached string?
In iprintln you can use only simple strings (like str="string").
And as I know, strings with & (don't know a real name of this strings. somebody tell me, please) you can only precache and use for HUDs.

So, you can:
1. Make a simple string and use iprintln:

game["spawnprotection"] = "^2Spawn protection ^1OFF^7";
self iprintln(game["spawnprotection"]);
2. Make a HUD with your precached string:

game["spawnprotection"] = &"^2Spawn protection ^1OFF^7";
precacheString(game["spawnprotection"]);
self.hud = newClientHudElem(self);
self.hud.x = x;
self.hud.y = y;
self.hud.label = game["spawnprotection"];

maxdamage99
22nd March 2017, 14:37
HARDCORE: make anim progress bar for showing status of spawn protection;)

IzNoGoD
22nd March 2017, 15:40
HARDCORE: make anim progress bar for showing status of spawn protection;)

Just use scaleovertime(). Be sure to set new size to 1 pixel horizontal size. Setting it to 0 pixels is buggy on cod2, and will result in 10+ pixels.

kung foo man
23rd March 2017, 09:05
And as I know, strings with & (don't know a real name of this strings. somebody tell me, please) you can only precache and use for HUDs.

You could refer to them as "configstring strings" or "precached strings" (sic) ^^

guiismiti:

Basically you need to track yourself which values your precached strings have. IzNoGoD compiled this post with basically all info's: https://killtube.org/showthread.php?2087-Tutorial-settext()-without-precaching

guiismiti
23rd March 2017, 13:01
I actually solved my problem.
All I wanted was to avoid the localized string warning in the console, so I created a localized string (didn't know how to do it, I thought I only needed to precache a string).

So, for people with the same doubt:
Create a .str file in folder localizedstrings;
Write your strings:


REFERENCE WELCOME_MESSAGE
LANG_ENGLISH "^2Welcome to the battlefield"
LANG_GERMAN "#same"
LANG_RUSSIAN "#same"

REFERENCE SPAWN_PROTECTION_OFF
LANG_ENGLISH "^2Spawn protection ^1OFF^7"
LANG_GERMAN "#same"
LANG_RUSSIAN "#same"

ENDMARKER

Print it like this (where FILENAME is the name of the .str file you created):


player iprintln(&"FILENAME_SPAWN_PROTECTION_OFF");

guiismiti
26th March 2017, 00:49
What is the name of the grenade hud?
1306
I need to hide it and disableWeapon() doesn't do it.
I've been looking for a way to do it, but couldn't find it.

filthy_freak_
26th March 2017, 03:20
It's a menu hud, hud.menu if I remember correctly.

guiismiti
4th April 2017, 23:56
How hard-coded is vote calling?
I checked menu kickplayer and the response of the "Ok" button is "uiScript voteTempBan".
Is it possible to edit vote calling? I may be wrong, but, a few years ago, I remember seeing mods that could enable/disable the particular kinds of vote calling (e. g. allow map change, but not kicking). I know you can display/hide the menu elements with dvars, but I'm not sure if you can stop players from calling votes through console commands without editing vote calling functions.

Maybe this?
https://killtube.org/showthread.php?1082-CoD2-create-functions-in-menu-files!&p=3519&viewfull=1#post3519

Anyway, I'm almost done with a new kick menu (with temp IP ban), but I would still like to know.

IzNoGoD
5th April 2017, 02:01
Just look at the callbacks in callback_playercommand, you'll see the callvotes soon enough :)

raphael
18th July 2023, 20:41
NET_SendPacket ERROR: Resource temporarily unavailable to 194.27.72.36:-7108
NET_SendPacket ERROR: Resource temporarily unavailable to 194.27.72.36:-7096
NET_SendPacket ERROR: Resource temporarily unavailable to 194.249.87.231:-4841
NET_SendPacket ERROR: Resource temporarily unavailable to 194.27.72.36:-7161
NET_SendPacket ERROR: Resource temporarily unavailable to 194.27.72.36:-15452
NET_SendPacket ERROR: Resource temporarily unavailable to 194.249.87.231:-4731


What exactly does it says to me? That those IPs were seeking my server, but the response from the server couldn't be delivered?

hi did you figure what that means?