by Spike » Tue Jun 16, 2015 5:33 am
in CSQC_WorldLoaded, you can call getentitytoken a few times to parse the client's version of the entity lump / .ent file. this can be done without any ssqc changes. however, I do not believe this works in DP.
alternatively you can do this in ssqc: localcmd(sprintf("serverinfo wt %g\n", world.worldtype)); inside your worldspawn function, and worldtype = stof(serverkey("wt")); in your csqc. again, this will not work in DP.
alternatively you can use writebytes as toneddu2000, in order for it to work in DP, you will need to use MSG_ONE, and to hack at svc_tempentity. this will not work in saved games unless you use nosave hacks to detect when the game was saved etc (in fte, you would send from a sv_parseclientcommand 'enablecsqc' handler, to determine whenever the client's csqc has [re]started, while in dp you do not known when the client itself is up and running).
alternatively you can do a stuffcmd(self, sprintf("//worldtype %g\n", world.worldtype)); and scan for that prefix inside CSQC_Parse_StuffCmd. again, this will not normally work in saved games without extra work as described above.
alternatively you could use globalstat from worldspawn, along with a global that contains your value. however, globalstat does not exist in dp, but the server does at least have a chance of restoring the value automatically in saved games.
the penultimate option is clientstat as toneddu2000 described. logically this is the simplest method I can think of that will work in dp and should also persist in saved games - assuming the server remembers the mappings on load.
the final option is to use SendEntity. the server will automatically resend the entity when the game is loaded. you can add all sorts of other fields too, you can send strings without worrying about length truncations (unlike dp's stats). however, to resend the entity the entity must be within the client's pvs, and dp does not provide you with the ability to ensure this is always the case, unless you reuse the player's entity for this purpose.
.