[Extension] Player Command Control (includes CHAT-Control for Builtin-B3!)

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

/*================Called by code after the level's main script function has run.================*/CodeCallback_StartGameType(){// If the gametype has not beed started, run the startupif(!isDefined(level.gametypestarted) || !level.gametypestarted) { [[level.callbackStartGameType]]();

level.gametypestarted = true; // so we know that the gametype has been started up}}

/*================Called when a player begins connecting to the server.Called again for every map change or tournement restart.

Return undefined if the client should be allowed, otherwise returna string with the reason for denial.

Otherwise, the client will be sent the current gamestateand will eventually get to ClientBegin.

firstTime will be qtrue the very first time a client connectsto the server machine, but qfalse on map changes and tournementrestarts.================*/CodeCallback_PlayerConnect(){self endon("disconnect"); [[level.callbackPlayerConnect]]();}

/*================Called when a player drops from the server.Will not be called between levels.self is the player that is disconnecting.================*/CodeCallback_PlayerDisconnect(){self notify("disconnect"); [[level.callbackPlayerDisconnect]]();}

/*================Called when a player has taken damage.self is the player that took damage.================*/CodeCallback_PlayerDamage(eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, timeOffset){self endon("disconnect"); [[level.callbackPlayerDamage]](eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, timeOffset);}

/*================Called when a player has been killed.self is the player that was killed.================*/CodeCallback_PlayerKilled(eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration){self endon("disconnect"); [[level.callbackPlayerKilled]](eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration);}

/*================Called from the gametype script to store off the default callback functions.This allows the callbacks to be overridden by level script, but not lost.================*/SetDefaultCallbacks(){level.default_CallbackStartGameType = level.callbackStartGameType;level.default_CallbackPlayerConnect = level.callbackPlayerConnect;level.default_CallbackPlayerDisconnect = level.callbackPlayerDisconnect;level.default_CallbackPlayerDamage = level.callbackPlayerDamage;level.default_CallbackPlayerKilled = level.callbackPlayerKilled;}

/*================Called when a gametype is not supported.================*/AbortLevel(){println("Aborting level - gametype is not supported");

The "player spawn(origin, angle)"-function is crashing the server when used in CodeCallback_PlayerCommand(args).

To prevent the Segmentation Fault, just write:

PHP Code:

CodeCallback_PlayerCommand(args){waittillframeend;// all other code... // all other code... // all other code...}

or:

PHP Code:

CodeCallback_PlayerCommand(args){wait 0.05;// all other code... // all other code... // all other code...}

Attention: Only call wait 0.05; or waittillframeend; when you really need to call the spawn-function! Because the arguments are saved in ONE global structure and when 2 players in a server write something near in the same time, the ClientCommand()-function is mixing up the data otherwise.