Modme Forums
Menu:

Shooting Trigger Gives Player Points

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


ModmeBot:

Thread By: MJPW
Hi I was looking for a little bit of a script for when a player shoots a trigger with a specific gun they get a specific amount of points every time they shoot it. Thanks!


ModmeBot:

Reply By: mathfag

MJPW
Hi I was looking for a little bit of a script for when a player shoots a trigger with a specific gun they get a specific amount of points every time they shoot it. Thanks!

Here are 2 parts of a script I made for a custom map a while ago.

For shoot trigger for money
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)
    }
/}

For shoot trigger with wunderwaffe for perk
function wunder_perk()
{
    desiredweapon = getWeapon("tesla_gun"); // Weapon you want the player to have when shot
    // weapon = getWeapon(string);
    trig = getent("mee_wunder_perk", "targetname");
    trig waittill( "trigger", player );
    current_weapon = player getCurrentWeapon();
    while(1)
    {
        if( current_weapon == desiredweapon )
        {
        SDFM_Debug("Shot with wunderwaffe");
        perk_struct = struct::get("wunder_perk_struct", "targetname");
        zm_powerups::specific_powerup_drop("free_perk", perk_struct.origin,undefined ,undefined ,undefined , undefined, true);
        PlaySoundAtPosition("mee_reward", perk_struct.origin);
        SDFM_Debug("perk spawn");
        trig Delete();
        }
        else
        {
        SDFM_Debug("not wunderwaffe");
        continue;    
        }

    break;
    }
}

Do what you want with this


ModmeBot:

Reply By: Abnormal202
what is that while(1) for? it is completely pointless...


ModmeBot:

Reply By: mathfag

Abnormal202
what is that while(1) for? it is completely pointless...

in the first script: i have no idea why i put it there
in the second one it's necessary


ModmeBot:

Reply By: KillJoyYT
hey dude I'm getting this error.... any idea?


^1ERR(6E) scripts/zm/zm_saw2.gsc (1321,1) : Compiler Internal Error : Unresolved external 'zm_score::add_to_player_score'


ModmeBot:

Reply By: Harry Bo21

KillJoyYT
hey dude I'm getting this error.... any idea? ^1ERR(6E) scripts/zm/zm_saw2.gsc (1321,1) : Compiler Internal Error : Unresolved external 'zm_score::add_to_player_score'


#using scripts\zm\_zm_score;


ModmeBot:

Reply By: KillJoyYT
thank you works like a gem!