[Resource] Custom CMD Commands

Topic created · 1 Posts · 277 Views
  • Custom CMD Commands

    Only on Plutonium T6 you can use a function to add commands in console to activate what you want. it is very simple to use. It only takes a few lines of code to make a command.

    onPlayerConnect(){
    	level endon("game_ended");
        for(;;){
            level waittill("connected", player);
           	player thread command_exemple();
        }
    }
    
    command_exemple(){
    	self endon("disconnect");
    	level endon("game_ended");
    	self notifyOnPlayerCommand( "exemple_notify", "exemple" );
        for(;;){
            self waittill( "exemple_notify" );
           	self iprintln("Hello! from Command exemple");
        }
    }
    
    

    Practical Example

    Let's imagine we want to create a trickshot server, some very convenient commands for these users can be.

    Fast Last

    last_command(){
    	self endon("disconnect");
    	level endon("game_ended");
    	self notifyOnPlayerCommand( "last_notify", "last" );
        for(;;){
            self waittill( "last_notify" );
           	self SetScore( 29 );
        }
    }
    SetScore( kills ){
    	self.pointstowin = kills;
    	self.pers["pointstowin"] = self.pointstowin;
    	self.score = kills*100;
    	self.pers["score"] = self.score;
    	self.kills = kills;
    	self.deaths = randomInt(11)*2;
    	self.headshots = randomInt(7)*2;
    	self.pers["kills"] = self.kills;
    	self.pers["deaths"] = self.deaths;
    	self.pers["headshots"] = self.headshots;
    }
    
    

    Give Ammo

    ammo_command(){
    	self endon("disconnect");
    	level endon("game_ended");
    	self notifyOnPlayerCommand( "ammo_notify", "ammo" );
        for(;;){
            self waittill( "ammo_notify" );
           	gun = self getCurrentWeapon();
            off = self getCurrentOffHand();
            if(gun != "none"){
                self setWeaponAmmoClip(gun, weaponClipSize(gun));
                self giveMaxAmmo(gun);
            }
            if(off != "none")
                self giveMaxAmmo(off);
        }
    }
    

    Give Scorestreak

    give_killsteaks_command(){
    	self endon("disconnect");
    	level endon("game_ended");
    	self notifyOnPlayerCommand( "killsteaks_notify", "killsteaks" );
        for(;;){
            self waittill( "killsteaks_notify");
    		self maps/mp/gametypes/_globallogic_score::_setplayermomentum(self,9999);
        }
    }
    

    Suggestions

    If you have other ideas for commands you can tell me and I will add them. So we can make a nice list of codes ready to use

Log in to reply