Modme Forums

add price to door

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


ModmeBot:

Thread By: KillJoyYT
how can I add a price to my door function? sorry im still a noob


function dissapearing_platform1()
{
    trig_1 = GetEnt("platform_trig_1", "targetname");

    model_1 = GetEnt("platform_model_1", "targetname");

brushmodel_1 = GetEnt("platform_brushmodel_1", "targetname");


    trig_1 SetHintString("Hold &&1 To Buy [Cost: 1000]");
    trig_1 SetCursorHint("HINT_NOICON");

        trig_1 waittill("trigger", player);
    player PlayLocalSound( "demo14" );
        trig_1 Delete();
        model_1 Delete();
        brushmodel_1 Delete();
}





ive seen mathfag post for adding points im sure you could just change to minus_to_player_score but don't you need to check first if the player has enough points for the door?


function cash_reg(player) //needs player in brackets
{
    trig_cash_reg = GetEnt("mee_cash_reg_trig", "targetname");
    model_cash_reg = GetEnt("mee_cash_reg", "targetname");


    trig_cash_reg SetHintString("");
    trig_cash_reg SetCursorHint("HINT_NOICON");
 
    while(1)
    {
        trig_cash_reg waittill("trigger", trig_cash_reg);
        thread Give_cash_pts();
/        PlaySoundAtPosition("zmb_cha_ching", trig_cash_reg.origin); 
 
        break;
    }
 
    trig_cash_reg Delete(); //remove this to shoot multiple times
    PlayFXOnTag(fx_destroy, model_cash_reg, "tag_origin");
    model_cash_reg Delete();
}


function give_cash_pts()
{
players = GetPlayers();

    foreach(player in players)
    {
    player zm_score::add_to_player_score(2000);  //you can add tgus after the while above to only give it to 1 player. (remove thread give_cash_pts)
    }
}




any help is appreciated thank you


ModmeBot:

Reply By: ihmiskeho

function dissapearing_platform1()
{
    trig_1 = GetEnt("platform_trig_1", "targetname");
    model_1 = GetEnt("platform_model_1", "targetname");
	brushmodel_1 = GetEnt("platform_brushmodel_1", "targetname");

	cost = 1000;		//Change to whatever, added this to make it easier to change later 

    trig_1 SetHintString("Hold &&1 To Buy [Cost: "+cost+"]");
    trig_1 SetCursorHint("HINT_NOICON");

    while(1)
    {
    	trig_1 waittill("trigger", player);
    	if( player.score >= cost && zm_utility::is_player_valid( player ) )
    	{
    		player PlayLocalSound( "demo14" );
    		player zm_score::minus_to_player_score( cost );
      	 	break;
    	}

    	else
    	{
    		PlaySoundAtPosition("zmb_trap_deny", trig_1.origin);
			player zm_audio::create_and_play_dialog( "general", "outofmoney" );		//Remove this if you don't have character quotes
    	}
    }

    trig_1 Delete();
    model_1 Delete();
    brushmodel_1 Delete();
}
Untested but should work, let me know if it doesn't


ModmeBot:

Reply By: KillJoyYT
thank you man

I just tested it and this is what the linker is saying


Linker will now terminate.
********************************************************************************

==================================================
Linker summary:

There were no errors or warnings.

==================================================

^1}
^1^
^1ERR(6E) scripts/zm/zm_monopoly.gsc (133,1) : Compiler Internal Error : Unresolved external 'zm_score::minus_to_player_score'




is there a #using score script I need for my gsc?

yeah
#using scripts\zm\_zm_score;


thanks again man :-)


ModmeBot:

Reply By: ihmiskeho

KillJoyYT
thank you man I just tested it and this is what the linker is saying Linker will now terminate. ******************************************************************************** ================================================== Linker summary: There were no errors or warnings. ================================================== ^1} ^1^ ^1ERR(6E) scripts/zm/zm_monopoly.gsc (133,1) : Compiler Internal Error : Unresolved external 'zm_score::minus_to_player_score' is there a #using score script I need for my gsc? yeah #using scripts\zm\_zm_score; thanks again man :-)

Ah, completely forgot about that. Glad you got it working tho