Modme Forums
Menu:

god mode trigger

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: m1cke
I made this script when i was board but it dosen't give me god mod

and when i buy it the trigger dosen't dissaper like it still says press f for god mod

thanks for eny help

function givegod()
{
	trigger = GetEnt("GetGod", "targetname");
	trigger SetHintString("Press ^3&&1^7 For GOD MODE");
	trigger SetCursorHint("HINT_NOICON");
	GodCost = 1000;
	trigger waittill("trigger", player);

	if(player.score >= GodCost)
	{
		player zm_score::minus_to_player_score(GodCost);
		trigger PlayLocalSound( "cha_ching" );
		ModVar( "god", 1 ); 
		break;
	}
	else
	{
		trigger PlayLocalSound ( "deny" );
	}
}


ModmeBot:

Reply By: natesmithzombies
Give this a shot. I added a few things to make it a bit better for multiple players.

function givegod()
{
    trigger = GetEnt("GetGod", "targetname");
    trigger SetHintString("Press ^3&&1^7 For GOD MODE");
    trigger SetCursorHint("HINT_NOICON");
    GodCost = 1000;
	
	while(1) // Added this in a loop so that players can have a multiple chances to buy the trigger 
	{
	    trigger waittill("trigger", player);
 
		if(player.score >= GodCost && !isDefined(player.is_god)) // added an additional check 
		{
			player zm_score::minus_to_player_score(GodCost);
			player PlayLocalSound( "cha_ching" );	// Changed trigger to player. Only players can use PlayLocalSound
			// ModVar( "god", 1 ); // Not sure why this isnt working
			player EnableInvulnerability(); // This is the same thing as god mode 
			player.is_god = true; // added this for some more checks 
			// break; you dont need this 
			trigger SetHintStringForPlayer( player, "Press ^3&&1^7 to disable God Mode" ); // never actually tested the hintstring for specific players. This is new from WaW GSC so let me know if this works 
			wait(2); 
		}
		else if( isDefined(player.is_god) && player.is_god ) // added the option to disable god mode 
		{
			player DisableInvulnerability(); 
			trigger SetHintStringForPlayer(player, "Press ^3&&1^7 For GOD MODE");
			player.is_god = undefined; 
			wait(2); 
		}
		else
		{
			trigger SetHintStringForPlayer( player, "You Need "+GodCost+" points to Enable God Mode" ); // added this because it looks nicer IMO 
			trigger PlayLocalSound ( "deny" );
			wait(2); // wait here a bit because players could just spam the trigger 
			trigger SetHintStringForPlayer(player, "Press ^3&&1^7 For GOD MODE");
		}
	}
}


ModmeBot:

Reply By: m1cke

natesmithzombiesGive this a shot. I added a few things to make it a bit better for multiple players.

function givegod()
{
    trigger = GetEnt("GetGod", "targetname");
    trigger SetHintString("Press ^3&&1^7 For GOD MODE");
    trigger SetCursorHint("HINT_NOICON");
    GodCost = 1000;
	
	while(1) // Added this in a loop so that players can have a multiple chances to buy the trigger 
	{
	    trigger waittill("trigger", player);
 
		if(player.score >= GodCost && !isDefined(player.is_god)) // added an additional check 
		{
			player zm_score::minus_to_player_score(GodCost);
			player PlayLocalSound( "cha_ching" );	// Changed trigger to player. Only players can use PlayLocalSound
			// ModVar( "god", 1 ); // Not sure why this isnt working
			player EnableInvulnerability(); // This is the same thing as god mode 
			player.is_god = true; // added this for some more checks 
			// break; you dont need this 
			trigger SetHintStringForPlayer( player, "Press ^3&&1^7 to disable God Mode" ); // never actually tested the hintstring for specific players. This is new from WaW GSC so let me know if this works 
			wait(2); 
		}
		else if( isDefined(player.is_god) && player.is_god ) // added the option to disable god mode 
		{
			player DisableInvulnerability(); 
			trigger SetHintStringForPlayer(player, "Press ^3&&1^7 For GOD MODE");
			player.is_god = undefined; 
			wait(2); 
		}
		else
		{
			trigger SetHintStringForPlayer( "You Need "+GodCost+" points to Enable God Mode" ); // added this because it looks nicer IMO 
			trigger PlayLocalSound ( "deny" );
			wait(2); // wait here a bit because players could just spam the trigger 
			trigger SetHintStringForPlayer(player, "Press ^3&&1^7 For GOD MODE");
		}
	}
}



i got an error from line 140 "trigger SetHintStringForPlayer( "You Need "+GodCost+" points to Enable God Mode" ); // added this because it looks nicer IMO" says 1 paramters


ModmeBot:

Reply By: m1cke

natesmithzombiesGive this a shot. I added a few things to make it a bit better for multiple players.

function givegod()
{
    trigger = GetEnt("GetGod", "targetname");
    trigger SetHintString("Press ^3&&1^7 For GOD MODE");
    trigger SetCursorHint("HINT_NOICON");
    GodCost = 1000;
	
	while(1) // Added this in a loop so that players can have a multiple chances to buy the trigger 
	{
	    trigger waittill("trigger", player);
 
		if(player.score >= GodCost && !isDefined(player.is_god)) // added an additional check 
		{
			player zm_score::minus_to_player_score(GodCost);
			player PlayLocalSound( "cha_ching" );	// Changed trigger to player. Only players can use PlayLocalSound
			// ModVar( "god", 1 ); // Not sure why this isnt working
			player EnableInvulnerability(); // This is the same thing as god mode 
			player.is_god = true; // added this for some more checks 
			// break; you dont need this 
			trigger SetHintStringForPlayer( player, "Press ^3&&1^7 to disable God Mode" ); // never actually tested the hintstring for specific players. This is new from WaW GSC so let me know if this works 
			wait(2); 
		}
		else if( isDefined(player.is_god) && player.is_god ) // added the option to disable god mode 
		{
			player DisableInvulnerability(); 
			trigger SetHintStringForPlayer(player, "Press ^3&&1^7 For GOD MODE");
			player.is_god = undefined; 
			wait(2); 
		}
		else
		{
			trigger SetHintStringForPlayer( "You Need "+GodCost+" points to Enable God Mode" ); // added this because it looks nicer IMO 
			trigger PlayLocalSound ( "deny" );
			wait(2); // wait here a bit because players could just spam the trigger 
			trigger SetHintStringForPlayer(player, "Press ^3&&1^7 For GOD MODE");
		}
	}
}



nvm got the timer thing to work Thanks alot nate


ModmeBot:

Reply By: natesmithzombies

m1ckenvm got the timer thing to work Thanks alot nate


Ahh missed the player argument but I edited the original post so others wont get an error. I can never test things at work or university. I always seem to miss something small. Good to see you got it working!


ModmeBot:

Reply By: m1cke

m1cke
natesmithzombiesGive this a shot. I added a few things to make it a bit better for multiple players.

function givegod()
{
    trigger = GetEnt("GetGod", "targetname");
    trigger SetHintString("Press ^3&&1^7 For GOD MODE");
    trigger SetCursorHint("HINT_NOICON");
    GodCost = 1000;
	
	while(1) // Added this in a loop so that players can have a multiple chances to buy the trigger 
	{
	    trigger waittill("trigger", player);
 
		if(player.score >= GodCost && !isDefined(player.is_god)) // added an additional check 
		{
			player zm_score::minus_to_player_score(GodCost);
			player PlayLocalSound( "cha_ching" );	// Changed trigger to player. Only players can use PlayLocalSound
			// ModVar( "god", 1 ); // Not sure why this isnt working
			player EnableInvulnerability(); // This is the same thing as god mode 
			player.is_god = true; // added this for some more checks 
			// break; you dont need this 
			trigger SetHintStringForPlayer( player, "Press ^3&&1^7 to disable God Mode" ); // never actually tested the hintstring for specific players. This is new from WaW GSC so let me know if this works 
			wait(2); 
		}
		else if( isDefined(player.is_god) && player.is_god ) // added the option to disable god mode 
		{
			player DisableInvulnerability(); 
			trigger SetHintStringForPlayer(player, "Press ^3&&1^7 For GOD MODE");
			player.is_god = undefined; 
			wait(2); 
		}
		else
		{
			trigger SetHintStringForPlayer( "You Need "+GodCost+" points to Enable God Mode" ); // added this because it looks nicer IMO 
			trigger PlayLocalSound ( "deny" );
			wait(2); // wait here a bit because players could just spam the trigger 
			trigger SetHintStringForPlayer(player, "Press ^3&&1^7 For GOD MODE");
		}
	}
}



nvm got the timer thing to work Thanks alot nate


only problem i have is i can't buy it again after the timer


ModmeBot:

Reply By: natesmithzombies

m1ckeonly problem i have is i can't buy it again after the timer


What timer? I am not sure what you mean


ModmeBot:

Reply By: m1cke

natesmithzombies
m1ckeonly problem i have is i can't buy it again after the timer


What timer? I am not sure what you mean


i added this what i mean is that it waits 10 min then it disables god mode and i wanna make it buyable again but i can't get it to work

player zm_score::minus_to_player_score(GodCost);
            player PlayLocalSound( "cha_ching" );   // Changed trigger to player. Only players can use PlayLocalSound
            // ModVar( "god", 1 ); // Not sure why this isnt working
            player EnableInvulnerability(); // This is the same thing as god mode
            player.is_god = true; // added this for some more checks
            IPrintLnBold ("God Mode FOR 10 Minutes");
            trigger TriggerEnable( false );
            wait (600);
            IPrintLnBold ("God mode over");
            player DisableInvulnerability();
            trigger TriggerEnable( true );
            thread givegod(); // I added this to try but it dosen't wanna work :(
            //break;
            //trigger SetHintStringForPlayer( player, "Press ^3&&1^7 to disable God Mode" ); // never actually tested the hintstring for specific players. This is new from WaW GSC so let me know if this works


ModmeBot:

Reply By: natesmithzombies

m1cke
natesmithzombies
m1ckeonly problem i have is i can't buy it again after the timer


What timer? I am not sure what you mean


i added this what i mean is that it waits 10 min then it disables god mode and i wanna make it buyable again but i can't get it to work


Try this:

function givegod()
{
    trigger = GetEnt("GetGod", "targetname");
    trigger SetHintString("Press ^3&&1^7 For GOD MODE");
    trigger SetCursorHint("HINT_NOICON");
    GodCost = 1000;
     
    while(1) // Added this in a loop so that players can have a multiple chances to buy the trigger
    {
        trigger waittill("trigger", player);
  
        if(player.score >= GodCost && !isDefined(player.is_god)) // added an additional check
        {
            player zm_score::minus_to_player_score(GodCost);
            player PlayLocalSound( "cha_ching" );   // Changed trigger to player. Only players can use PlayLocalSound
            // ModVar( "god", 1 ); // Not sure why this isnt working
            player EnableInvulnerability(); // This is the same thing as god mode
            player.is_god = true; // added this for some more checks
            // break; you dont need this
            trigger SetHintStringForPlayer( player, "You Are Already in God Mode" );
			player thread god_cooldown(trigger); 
			wait(2);
        }
        else if( isDefined(player.is_god) && player.is_god ) // added the option to disable god mode
        {
			
        }
        else
        {
            trigger SetHintStringForPlayer( player, "You Need "+GodCost+" points to Enable God Mode" ); // added this because it looks nicer IMO
            trigger PlayLocalSound ( "deny" );
            wait(2); // wait here a bit because players could just spam the trigger
            trigger SetHintStringForPlayer(player, "Press ^3&&1^7 For GOD MODE");
        }
    }
}

function god_cooldown(trigger)
{
	wait(600); 
	trigger SetHintStringForPlayer(self, "Press ^3&&1^7 For GOD MODE");
	self.is_god = undefined; 
	self DisableInvulnerability();
	self iprintlnbold( "God Mode Disabled" ); 
}


ModmeBot:

Reply By: m1cke

natesmithzombies
m1cke
natesmithzombies
m1ckeonly problem i have is i can't buy it again after the timer


What timer? I am not sure what you mean


i added this what i mean is that it waits 10 min then it disables god mode and i wanna make it buyable again but i can't get it to work


Try this:

function givegod()
{
    trigger = GetEnt("GetGod", "targetname");
    trigger SetHintString("Press ^3&&1^7 For GOD MODE");
    trigger SetCursorHint("HINT_NOICON");
    GodCost = 1000;
     
    while(1) // Added this in a loop so that players can have a multiple chances to buy the trigger
    {
        trigger waittill("trigger", player);
  
        if(player.score >= GodCost && !isDefined(player.is_god)) // added an additional check
        {
            player zm_score::minus_to_player_score(GodCost);
            player PlayLocalSound( "cha_ching" );   // Changed trigger to player. Only players can use PlayLocalSound
            // ModVar( "god", 1 ); // Not sure why this isnt working
            player EnableInvulnerability(); // This is the same thing as god mode
            player.is_god = true; // added this for some more checks
            // break; you dont need this
            trigger SetHintStringForPlayer( player, "You Are Already in God Mode" );
			player thread god_cooldown(trigger); 
			wait(2);
        }
        else if( isDefined(player.is_god) && player.is_god ) // added the option to disable god mode
        {
			
        }
        else
        {
            trigger SetHintStringForPlayer( player, "You Need "+GodCost+" points to Enable God Mode" ); // added this because it looks nicer IMO
            trigger PlayLocalSound ( "deny" );
            wait(2); // wait here a bit because players could just spam the trigger
            trigger SetHintStringForPlayer(player, "Press ^3&&1^7 For GOD MODE");
        }
    }
}

function god_cooldown(trigger)
{
	wait(600); 
	trigger SetHintStringForPlayer(self, "Press ^3&&1^7 For GOD MODE");
	self.is_god = undefined; 
	self DisableInvulnerability();
	self iprintlnbold( "God Mode Disabled" ); 
}



Thanks nate works perfecly now


ModmeBot:

Reply By: natesmithzombies

m1ckThanks nate works perfecly now


You're welcome


ModmeBot:

Reply By: Blink-420

natesmithzombies
m1ckThanks nate works perfecly now


You're welcome


Is there a way to add a cooldown before you can buy it again? So people couldnt just sit by the trigger with tons of points and be invincible most of the game


ModmeBot:

Reply By: m1cke

Blink-420
natesmithzombies
m1ckThanks nate works perfecly now


You're welcome


Is there a way to add a cooldown before you can buy it again? So people couldnt just sit by the trigger with tons of points and be invincible most of the game


function god_cooldown(trigger)
{
    wait(600); // Edit this for the cooldown value 1 = 1 second
    self.is_god = undefined;
    self DisableInvulnerability();
    self iprintlnbold( "God Mode Disabled" );
    trigger SetHintStringForPlayer( self, "Comback later" );
    wait(1337); // Change 1337 to how meny seconds you want
    trigger SetHintStringForPlayer(self, "Press ^3&&1^7 For GOD MODE");
}

All you need to to is replace the cooldown function with this


ModmeBot:

Reply By: Blink-420

m1cke
Blink-420
natesmithzombies
m1ckThanks nate works perfecly now


You're welcome


Is there a way to add a cooldown before you can buy it again? So people couldnt just sit by the trigger with tons of points and be invincible most of the game


function god_cooldown(trigger)
{
    wait(600); // Edit this for the cooldown value 1 = 1 second
    self.is_god = undefined;
    self DisableInvulnerability();
    self iprintlnbold( "God Mode Disabled" );
    trigger SetHintStringForPlayer( self, "Comback later" );
    wait(1337); // Change 1337 to how meny seconds you want
    trigger SetHintStringForPlayer(self, "Press ^3&&1^7 For GOD MODE");
}

All you need to to is replace the cooldown function with this


Gracias :)