Comments (9)
Stop using SetText() with dynamically generated strings.
from cod4x_server.
@T-Maxxx is there a solution to it?
i assume the problem is that each hud settext(dynamicStuff) creates a new string reference. once all configstring handles are used that error pops up.
is there a way to manually free a unused string handle?
from cod4x_server.
i think that shows how to use it correctly .. but im not sure :)
self.hudhs.label = &"^5Headshots :^0 &&1";
self.hudhs setValue(self.headshots);
source: http://files.hiperz.com/cod4/%5E5myf_%5E1v1/promod/_huds.gsc
from cod4x_server.
This list cleared each map change. On pure server without scripts available about 400 configstrings.
I'm not sure about "&&1" in label string but setValue works only with decimal or float values. There should be concatenation, not format parsing for label and value. And OrigiTosko using player names as strings.
If you set "a" as configstring, it will be used instead of new configstring when called settext("a") again.
from cod4x_server.
oh i see .. not a solution then. however the same placeholders are visible here #42 so i would assume there is a way to do it.
maybe .label = &"conststr &&1"; combined with setText(dynamicStr); works
from cod4x_server.
It will also consume configstring.
CS is a way to send text from server to client.
from cod4x_server.
solved it i think.
setHudTextSafe(hudelem, txt)
{
if(!isDefined(hudelem))
return;
hudelem setText(txt);
hudelem clearAllTextAfterHudElem();
}
testhud()
{
if(!isDefined(self.hudkillstreak))
{
self.hudkillstreak = newClientHudElem(self);
self.hudkillstreak.x = 110;
self.hudkillstreak.y = 13;
self.hudkillstreak.alignx = "left";
self.hudkillstreak.horzAlign = "left";
self.hudkillstreak.fontscale = 1.4;
//self.hudkillstreak.label = &"^5Killstreak :^0 &&1";
self.hudkillstreak fadeOverTime(.5);
self.hudkillstreak.hidewheninmenu = true;
self.hudkillstreak.alpha = 1;
self.hudkillstreak.glowAlpha = 1;
self.hudkillstreak.glowColor = (0.3, 0.3, 0.3);
}
while(1)
{
level.counter++;
text = "str:" + level.counter;
setHudTextSafe(self.hudkillstreak, text);
wait 0.5;
}
}
...
self thread testhud(); // ran this after spawn (dont know if that is relevant)
note: it appears that it is enough to run clearAllTextAfterHudElem() on just one hudelement. so if you use multiple elements at once, you just need to clear one. i have no idea if that is anyhow relevant to performance. also clearing a dummy hudelement once a second might provide a more general solution to the problem.
altough there are some weird warnings in the console :S
Warning: abandoning const config string model slot for string §Overflow on 1335
Warning: abandoning const config string model slot for string §str:591
from cod4x_server.
i also haven't tested this with multiple players ...
@OrigiTosko you could try to replace all hud setText(text)
calls with the setHudTextSafe(hud, text)
function i posted above. i think it's worth giving it a shot.
from cod4x_server.
This is not a solution! It clears ALL CSs after this element CS whether used or not!
But! I have an idea :) I will make pull request soon.
from cod4x_server.
Related Issues (20)
- .ff different from server help HOT 3
- Server received signal: Segmentation fault HOT 2
- Problems with downloads HOT 15
- problem starting bots with my mod HOT 19
- CL_CGameNeedsServerComand:a reliable command was cycled out HOT 4
- [BUG] AmbientPlay is crap since 20.X HOT 12
- problem with compiling cod4x server in linux debian. HOT 5
- [request] The need of stock asset registration skip HOT 2
- Demo Recording Filename HOT 6
- Torjan - Can't be false positive? HOT 2
- Impure client detected! Invalid .IWD files referenced! HOT 3
- Error HOT 1
- Implement NAT Hole punching HOT 7
- Find game files (main, zone) from current working directory rather than where the binary is HOT 1
- Multiple Steamid same playerid HOT 7
- Impure client detected HOT 4
- Compile errors HOT 2
- cannot execute: required file not found debug HOT 4
- kill then start server causes "Warning: NET_IP4Socket: bind: Address already in use" HOT 3
- blank
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cod4x_server.