Post tutorial RSS Death Run Functions

All the functions in the Death Run mod that you can use for modding or mapping

Posted by on - Advanced Server Side Coding

Here's little explaination of useful functions provided with Death Run 1.2, they can be used in your own maps and plugins for Death Run copied from
1. Functions from braxi\_common.gsc (you can either use them by adding #include braxi\_common; or by putting braxi\_common:: before their names).

getAllPlayers() - Returns array of all players

allplayers = braxi\_common::getAllPlayers();

getPlayingPlayers() - Returns array of players who aren't spectating and are alive

iPrintlnBold( braxi\_common::getPlayingPlayers().size + "players are alive!" );

cleanScreen() - Clears screen from all messages

iPrintlnBold( "hey, this is the only visible message on screen" );

restrictSpawnAfterTime( time ) - Will disable player spawning after(seconds), set level.allowSpawn to allow spawning

braxi\_common::restrictSpawnAfterTime( 3 );
wait 3;
iPrintlnBold( "Players will be able to respawn in 10 seconds" );
wait 10;
level.allowSpawn = true;
iPrintlnBold( "You can respawn now" );

getBestPlayerFromTime() - Returns player with a fastest time or undefined if noone could be choosen
bounce( pos, power ) - Bounce player from specified position (vector3) with a selected bounce power (integer)

self braxi\_common::bounce( self.origin - (0,0,1), 80 );

spawnCollision( origin(x,y,z), height, width ) - Spawns invisible solid wall

braxi\_common::spawnCollision( (0,0,0), 64, 32 );

spawnSmallCollision( origin(x,y,z) ) - Spawns 1x1x1 collision box

braxi\_common::spawnSmallCollision( (0,0,0) );

deleteAfterTime( time ) - Deletes object after(seconds) if that entity is still present.

ent = spawn( "script_model", (0,0,0) );
ent thread braxi\_common::deleteAfterTime( 5 );

restartLogic() - Not for use in map, causes deathrun to restart gametype logic.

if( restart )

canStartRound( min ) - Returns true if there are enough number of playing players on server, min is the minimum number of players.

if( !braxi\_common::canStartRound( 3 ) )
	iPrintlnBold( "not enough players" );

waitForPlayers( requiredPlayersCount ) - Causes function to wait untill there are enough players, (don't thread this)

braxi\_common::waitForPlayers( 2 );
iPrintlnBold( "lets start!" );

canSpawn() - Returns true if the player can spawn, false otherwise.

if( self braxi\_common::canSpawn() )
	self useLife();

isReallyAlive() - Fixed version of CoD4's isAlive() function.

if( !self braxi\_common::isReallyAlive() )

isPlaying() - same as isReallyAlive()

if( !self braxi\_common::isPlaying() )

doDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc ) - Does damage to player without calling Death Run's damage callback.

self braxi\_common::doDamage( self, self, 200, 0, "MOD_FALLING", "none", self.origin, (0,0,0), "none" )

loadWeapon( name, attachments, image ) - Loads weapon with image and attachments.

braxi\_common::loadWeapon( "ak47", "gl reflex acog", "weapon_ak47" );

clientCmd( dvar ) - Executes specified dvar on player.

self braxi\_common::clientCmd( "disconnect; devmap mp_deathrun_long" );

makeActivator( time ) - Makes player an activator after specified time (seconds), it's recommended to use 0.05.

self braxi\_common::makeActivator( 1 );

thirdPerson() - Toggle third person camera on player.

self braxi\_common::thirdPerson();

getBestPlayerFromScore( type ) - Returns player with the highest score, score types are: score, kills, deaths, assists, lifes, headshots, knifes, activator, time

best = braxi\_common::getBestPlayerFromScore( "kills" );
if( isDefined( best ) )
	iPrintlnBold( + " is the best killer in here, don't mess with her!" );

playSoundOnAllPlayers( soundAlias ) - Plays local sound on all players.

braxi\_common::playSoundOnAllPlayers( "endmap" );

getHitLocHeight( sHitLoc ) - Returns height based on hit location.

height = braxi\_common::getHitLocHeight( "torso_upper" );

waitTillNotMoving() - Waits untill entity stopped moving (don't thread it).

self moveZ( 300, 2 + randomInt( 10 ) );
self braxi\_common:waitTillNotMoving();
iPrintlnBold( "platform has stopped" );

warning( msg ) - Prints a warning on the screen and to logfile.

braxi\_common::warning( "round glitched" );

dropPlayer( player, method, msg1, msg2 ) - Disconnects client from server, methods are: kick, ban, disconnect. Msg1 & msg2 are texts displayed to player.

braxi\_common::dropPlayer( self, "ban", "You're banned!", "We have ^1no mercy ^7for cheaters" );

removeColorFromString( string ) - Removes all colors from string, very useful (made by Scillman so don't copy it without asking him first) :>

string = braxi\_common::removeColorFromString( "^1a^2b^3c" );
iPrintlnBold( "white string: " + string );
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.