[Modding] ClientSpawn


(putte00) #1

Hi there,

I want to add godmode automatically when a player spawns but I got a problem.
I had no problem to find the function used for it (ClientSpawn) but the problem is I want to execute the function cmd_godmode_f in that procedure which is in another “project” (cgame/game).
Is there any way to make this working, or is there another procedure in the same project like the godprocedure is?

Thanks in advance


(acQu) #2

Why would you do this in ClientSpawn ? In your case i would go for G_Damage.


(acQu) #3

Hi,

well when you look in cmd_god, then what this does is basically setting FL_GODMODE to the playerent. As you got the spawning ent in the paramater list of the clientspawn function, you can simply do

ent->flags |= FL_GODMODE;

to assign this value to the ent. All the other logic is up to you, but assigning this flag is what you want to do, right ?

Also i did not test this but it should work.

Greetz


(putte00) #4

Ok it worked, tyvm :slight_smile:


(acQu) #5

Yeah no problem. Don’t forget to rate my post, kidding :wink:

I think it didn’t work at first because this flag got overridden by some other procedure. You probably have to do your settings at the very end of ClientSpawn i assume.