[Modding] Help asked


(putte00) #1

Hello,

When any client spawns, I want it to freeze for 60 seconds.
I have found the syntax how to do it, but I just can’t seem to find a procedure/function that’s runned right after a match started and which contains the client class.

Also to unfreeze, I thought about using the runframe procedure but the problem is also no client info is available in there because it’s used for non-player entities.

Does anyone have an idea?


(Nitrox_) #2

Hi,

If you want to freeze them for 60 seconds when the match starts, you can use something like this :

Add to gclient_s:

qboolean freeze;

in ClientThink_real():


...
	} else if ( client->noclip ) {
		client->ps.pm_type = PM_NOCLIP;
	} else if ( client->ps.stats[STAT_HEALTH] <= 0 ) {
		client->ps.pm_type = PM_DEAD;
	} else {
		//Modify here
		if ( client->freeze )
			client->ps.pm_type = PM_FREEZE;
		else
			client->ps.pm_type = PM_NORMAL;
	}

In G_RunFrame(), add:


	{
		gentity_t *ent;
		if( level.time - level.startTime < 60000 ) {
			for( i = 0 ; i < level.numConnectedClients ; i++ ) {
				ent = &g_entities[level.sortedClients[ i ]];
				if( ent->client->sess.sessionTeam != TEAM_SPECTATOR ) {
					ent->client->freeze = qtrue;
				}
			}
		} else if ( level.time - level.startTime == 60000 ) {
			for( i = 0 ; i < level.numConnectedClients ; i++ ) {
				ent = &g_entities[level.sortedClients[ i ]];
				if( ent->client->sess.sessionTeam != TEAM_SPECTATOR ) {
					ent->client->freeze = qfalse;
				}
			}
		}
	}

I hope it helps :slight_smile: