Modme Forums
Menu:

A script I need for my map to be complete

Modme | General


jfuvv:

Just a quick question does anyone know the script for when if you fell off a challenge map it will spawn you back on the map it would amazing if someone could help me thank you


KillJoy:

in your mapname.gsc directly under:

function main()

{

    zm_usermap::main();

add this

thread player_teleporter_init();


at very bottom of gsc

add this

function player_teleporter_init()
{
    player_tp = GetEntArray( "teleport_player", "targetname" );
    for( i = 0; i < player_tp.size; i++ )
    {
        player_tp[i] thread player_teleport();
    }
}

function player_teleport()
{
    destination = GetEnt( self.target, "targetname" );
    while(1)
    {
        self waittill( "trigger", player );
        player SetOrigin( destination.origin );
        player SetPlayerAngles( destination.angles );
    }
}



in Radiant:

add a trig_multi with the targetname "teleport_player"

add a script_origin
make sure you select server side kvp

deselect all

select the trig, then select the origin, then press w (this will auto link them for script)

expand the trig_multi to the area that is off the map
once the player touches the trigger, he will be teleported back to the origin

save compile link your map


that should be it, this is from my 2018 monopoly map so lmk if i missed anything


jfuvv:

in your mapname.gsc directly under:

function main()

{

    zm_usermap::main();

add this

thread player_teleporter_init();


at very bottom of gsc

add this

function player_teleporter_init()
{
    player_tp = GetEntArray( "teleport_player", "targetname" );
    for( i = 0; i < player_tp.size; i++ )
    {
        player_tp[i] thread player_teleport();
    }
}

function player_teleport()
{
    destination = GetEnt( self.target, "targetname" );
    while(1)
    {
        self waittill( "trigger", player );
        player SetOrigin( destination.origin );
        player SetPlayerAngles( destination.angles );
    }
}



in Radiant:

add a trig_multi with the targetname "teleport_player"

add a script_struct

deselect all

select the trig then select the struct then press w (this will auto link them for script)

expand the trig_multi to the area that is off the map
once the player touches the trigger, he will be teleported back to the struct

save compile link your map


that should be it, this is from my 2018 monopoly map so lmk if i missed anything

Your a legend pal thank you for the help thank you

jfuvv:

in your mapname.gsc directly under:

function main()

{

    zm_usermap::main();

add this

thread player_teleporter_init();


at very bottom of gsc

add this

function player_teleporter_init()
{
    player_tp = GetEntArray( "teleport_player", "targetname" );
    for( i = 0; i < player_tp.size; i++ )
    {
        player_tp[i] thread player_teleport();
    }
}

function player_teleport()
{
    destination = GetEnt( self.target, "targetname" );
    while(1)
    {
        self waittill( "trigger", player );
        player SetOrigin( destination.origin );
        player SetPlayerAngles( destination.angles );
    }
}



in Radiant:

add a trig_multi with the targetname "teleport_player"

add a script_struct

deselect all

select the trig then select the struct then press w (this will auto link them for script)

expand the trig_multi to the area that is off the map
once the player touches the trigger, he will be teleported back to the struct

save compile link your map


that should be it, this is from my 2018 monopoly map so lmk if i missed anything

Alright killjoy thank you for the script I followed every step and when I go into the trigger nothing happens have you got any idea why this could be happing ?

Pepergogo:

Hi [USER=291]@KillJoy[/USER]

I try the script but doesn't happen anything :(
When I touch the trigger it's like it wasn't there at all, any idea what I can do to solve it?





#using scripts\codescripts\struct;

#using scripts\shared\array_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\compass;
#using scripts\shared\exploder_shared;
#using scripts\shared\flag_shared;
#using scripts\shared\laststand_shared;
#using scripts\shared\math_shared;
#using scripts\shared\scene_shared;
#using scripts\shared\util_shared;

#insert scripts\shared\shared.gsh;
#insert scripts\shared\version.gsh;

#insert scripts\zm\_zm_utility.gsh;

#using scripts\zm\_load;
#using scripts\zm\_zm;
#using scripts\zm\_zm_audio;
#using scripts\zm\_zm_powerups;
#using scripts\zm\_zm_utility;
#using scripts\zm\_zm_weapons;
#using scripts\zm\_zm_zonemgr;

#using scripts\shared\ai\zombie_utility;

//Perks
#using scripts\zm\_zm_pack_a_punch;
#using scripts\zm\_zm_pack_a_punch_util;
#using scripts\zm\_zm_perk_additionalprimaryweapon;
#using scripts\zm\_zm_perk_doubletap2;
#using scripts\zm\_zm_perk_deadshot;
#using scripts\zm\_zm_perk_juggernaut;
#using scripts\zm\_zm_perk_quick_revive;
#using scripts\zm\_zm_perk_sleight_of_hand;
#using scripts\zm\_zm_perk_staminup;

//Powerups
#using scripts\zm\_zm_powerup_double_points;
#using scripts\zm\_zm_powerup_carpenter;
#using scripts\zm\_zm_powerup_fire_sale;
#using scripts\zm\_zm_powerup_free_perk;
#using scripts\zm\_zm_powerup_full_ammo;
#using scripts\zm\_zm_powerup_insta_kill;
#using scripts\zm\_zm_powerup_nuke;
//#using scripts\zm\_zm_powerup_weapon_minigun;

//Traps
#using scripts\zm\_zm_trap_electric;

#using scripts\zm\zm_usermap;

    // NSZ Brutus
    #using scripts\_NSZ\nsz_brutus;

//*****************************************************************************
// MAIN
//*****************************************************************************

function main()
{
    // NSZ Brutus
    brutus::init();

    zm_usermap::main();

    //Teleport player
    thread player_teleporter_init();
    
    level._zombie_custom_add_weapons =&custom_add_weapons;
    
    //Setup the levels Zombie Zone Volumes
    level.zones = [];
    level.zone_manager_init_func =&usermap_test_zone_init;
    init_zones[0] = "start_zone";
    level thread zm_zonemgr::manage_zones( init_zones );

    level.pathdist_type = PATHDIST_ORIGINAL;

    //Brutus Boss fight
    thread brutus_doo_dah();
}

function usermap_test_zone_init()
{
    level flag::init( "always_on" );
    level flag::set( "always_on" );
}   

function custom_add_weapons()
{
    zm_weapons::load_weapon_spec_from_table("gamedata/weapons/zm/zm_levelcommon_weapons.csv", 1);
}

//Brutus Boss Fight
function brutus_doo_dah()
{
    level.brutuses = 14; //amount of brutuses to spawn
    level.brutus_in_between_spawn_time = 30; //time between spawns for Brutus. If you're only spawning one Brutus, set this to 0.
    level.stop_zombies_from_spawning = false; //set "true" to stop zombies from spawning during Brutus fight.
    level.kill_all_zombies_before_fight = true; //set "true" to kill all zombies before Brutus fight.

    level.brutus_reward = "door"; //what happens when you kill all the Brutuses. Right now, options are: ("door","powerup","gun")
    level.brutus_reward_2 = false; //add another reward if you want. just say "false" or delete the line if you don't want an extra reward.
    level.brutus_reward_3 = false; //add yet another reward if you want. Note that you cannot do more than one of the same reward.
    level.brutus_powerup_type = "nuke"; //if using a powerup as one of your rewards, this is what type. can be ("full_ammo","nuke","insta_kill","free_perk","fire_sale","double_points","carpenter","minigun",and "random")
    level.brutus_reward_weapons = array( "ar_damage", "lmg_cqb", "shotgun_pump", "smg_versatile" ); //weapons it can give you in the "gun" reward. put as many or as little as you like.
    level.brutus_gun_expire = true; //whether or not the gun will go away in time.
    level.brutus_delete_door_after_move = true; //set "true" to delete the door after its done moving. Would recommend if it won't be seen.
    level.brutus_gun_hintstring = "Press ^3[{+activate}]^7 to take weapon"; //if gun reward is activated, hintstring for picking up gun.
    level.brutus_one_gun_per_player = true; //for gun powerup, set "true" if you want a gun to spawn for each player, "false" for just one gun no matter what.
    level.brutus_different_guns_per_player = false; //for gun powerup, set "true" if you want each gun to be randomly different, false if you want them to be the same random gun. if one_gun_per_player = "false" this doesn't matter.
    
    
    trig = GetEnt("brutus_trig","targetname");
    trig waittill("trigger",player);
    if(level.stop_zombies_from_spawning == true)
        level flag::clear( "spawn_zombies" );
    if(level.kill_all_zombies_before_fight == true)
    {
        zombies = zombie_utility::get_round_enemy_array();
        if ( isdefined( zombies ) )
        {
            array::run_all( zombies, &Kill );
        }
    }
    
    
    thread spawn_my_brutus();   
    
    
    
    level waittill("all_brutuses_down");
    //IPrintLnBold("recieved");
    if(level.stop_zombies_from_spawning == true)
        level flag::set( "spawn_zombies" );
    brutus_reward();
}
function spawn_my_brutus()
{
    brutus_spawners =  struct::get_array("brutus_arena_spawn","targetname");
    for(i=0;i<level.brutuses;i++)
    {
        rand = RandomIntRange( 0, brutus_spawners.size );
        brutus_spawners[rand] thread brutus::arena_spawn_brutus();
        wait(level.brutus_in_between_spawn_time);
    }
}
function brutus_reward()
{
    //IPrintLnBold("brutus_reward");
    if(level.brutus_reward == "door" || level.brutus_reward_2 == "door" || level.brutus_reward_3 == "door")
    {
        //IPrintLnBold("door reward");
        time = 2; //2 is amount of time in seconds door takes to move.
        door_parts = GetEntArray("brutus_door","targetname");
        for(i=0;i<door_parts.size;i++)
        {
            target = Struct::Get(door_parts[i].target,"targetname");
            if(isdefined(target))
                door_parts[i] MoveTo(target.origin, time);
            if(isdefined(door_parts[i].script_vector))
                door_parts[i] MoveTo(door_parts[i].origin + (door_parts[i].script_vector), time);
        }
        wait(time);
        
        if(level.brutus_delete_door_after_move == true)
        {
            for(i=0;i<door_parts.size;i++)
            {
                
                door_parts[i] Delete();
            }
        }
    }
    if(level.brutus_reward == "powerup" || level.brutus_reward_2 == "powerup" || level.brutus_reward_3 == "powerup")
    {
        powerup_struct = GetEnt("brutus_powerup_struct","targetname");
        if(level.brutus_powerup_type != "random")
            thread zm_powerups::specific_powerup_drop( level.brutus_powerup_type, powerup_struct.origin);
        if(level.brutus_powerup_type == "random")
        {
            rand = RandomIntRange( 0, 7 ); //("full_ammo","nuke","insta_kill","free_perk","fire_sale","double_points","carpenter","minigun")
            if(rand == 0)
                thread zm_powerups::specific_powerup_drop( "full_ammo", powerup_struct.origin);
            if(rand == 1)
                thread zm_powerups::specific_powerup_drop( "nuke", powerup_struct.origin);
            if(rand == 2)
                thread zm_powerups::specific_powerup_drop( "insta_kill", powerup_struct.origin);
            if(rand == 3)
                thread zm_powerups::specific_powerup_drop( "free_perk", powerup_struct.origin);
            if(rand == 4)
                thread zm_powerups::specific_powerup_drop( "fire_sale", powerup_struct.origin);
            if(rand == 5)
                thread zm_powerups::specific_powerup_drop( "double_points", powerup_struct.origin);
            if(rand == 6)
                thread zm_powerups::specific_powerup_drop( "carpenter", powerup_struct.origin);
            if(rand == 7)
                thread zm_powerups::specific_powerup_drop( "minigun", powerup_struct.origin);
        }
    }
    if(level.brutus_reward == "gun" || level.brutus_reward_2 == "gun" || level.brutus_reward_3 == "gun")
    {
        //IPrintLnBold("gun reward");
        if(level.brutus_one_gun_per_player == false)
            gun_struct = struct::get("brutus_gun_struct","targetname");
            thread brutus_RewardGun(gun_struct.origin+(0,0,40), array::randomize(level.brutus_reward_weapons)[0]);
        if(level.brutus_one_gun_per_player == true && level.brutus_different_guns_per_player == true)
        {
            gun_structs = struct::get_array("brutus_gun_struct","targetname");
            players = GetPlayers();
            for(i=0;i<players.size;i++)
            {
                thread brutus_RewardGun(gun_structs[i].origin+(0,0,40), array::randomize(level.brutus_reward_weapons)[0]);
            }
        }
        if(level.brutus_one_gun_per_player == true && level.brutus_different_guns_per_player == false)
        {
            rand = RandomIntRange( 0, level.brutus_reward_weapons.size );
            gun_structs = struct::get_array("brutus_gun_struct","targetname");
            players = GetPlayers();
            for(i=0;i<players.size;i++)
            {
                thread brutus_RewardGun(gun_structs[i].origin+(0,0,40), level.brutus_reward_weapons[rand]);
            }
        }
    }
}
function brutus_RewardGun(pos, weapon)
{
    gun = spawn("script_model", pos);
    playsoundatposition("zmb_spawn_powerup", pos);
    
    gun SetModel(GetWeaponWorldModel(GetWeapon(weapon)));
    PlayFX(level._effect["powerup_grabbed_solo"], gun.origin);
    trig = spawn("trigger_radius", gun.origin, 0, 20, 50);
    gun thread brutus_SpinMe();
    gun thread brutus_GiveMe(weapon, trig);
    if(level.brutus_gun_expire == true)
        gun thread brutus_LifeTime(trig);
}
function brutus_LifeTime(trig)
{
    self endon("death");
    wait(120);//wait 2 minutes then delete
    if(isdefined(self))
    {
        self notify("rewardgun_delete");
    }
    if(isdefined(trig))
    {
        trig delete();
    }
    if(isdefined(self))
    {
        self delete();
    }
}
function brutus_GiveMe(weapon, trig)
{
    self endon("rewardgun_delete");
    while(1)
    {
        trig waittill("trigger", player);
        player thread brutus_SetGunHint(level.brutus_gun_hintstring, trig);
        if(player HasWeapon(getweapon("minigun")))
        {
            continue;
        }
        if(!(player UseButtonPressed()))
        {
            continue;
        }
        if(player laststand::player_is_in_laststand())
        {
            continue;
        }
        trig delete();
        self delete();
        player zm_weapons::weapon_give(getweapon(weapon));
        player SwitchToWeapon(getweapon(weapon));
        break;
        wait(.1);
    }
}

function brutus_SpinMe()
{
    self endon("rewardgun_delete");
    self endon("death");
    while(isdefined(self))
    {
        if(isdefined(self))
        {
            self rotateyaw(360,2);
        }
        wait(1.9);
    }
}
function brutus_SetGunHint(text, trig)
{
    if(isdefined(self.brutus_gun_hud))
    {
        return;
    }
    self.brutus_gun_hud = NewClientHudElem( self );
    self.brutus_gun_hud.horzAlign = "center";
    self.brutus_gun_hud.vertAlign = "middle";
    self.brutus_gun_hud.alignX = "center";
    self.brutus_gun_hud.alignY = "middle";
    self.brutus_gun_hud.foreground = 1;
    self.brutus_gun_hud.fontscale = 1;
    self.brutus_gun_hud.alpha = 1;
    self.brutus_gun_hud.color = ( 0.44, .74, .94 );
    self.brutus_gun_hud SetText(text);
    while(isdefined(trig) && self IsTouching(trig))
    {
        wait(.05);
    }
    self.brutus_gun_hud SetText("");
    self.brutus_gun_hud Destroy();
    self.brutus_gun_hud = undefined;
}


//Teleport player
function player_teleporter_init()
{
    player_tp = GetEntArray( "teleport_player", "targetname" );
    for( i = 0; i < player_tp.size; i++ )
    {
        player_tp[i] thread player_teleport();
    }
}

function player_teleport()
{
    destination = GetEnt( self.target, "targetname" );
    while(1)
    {
        self waittill( "trigger", player );
        player SetOrigin( destination.origin );
        player SetPlayerAngles( destination.angles );
    }
}


eDeK:

Hi [USER=291]@KillJoy[/USER]

I try the script but doesn't happen anything :(
When I touch the trigger it's like it wasn't there at all, any idea what I can do to solve it?





#using scripts\codescripts\struct;

#using scripts\shared\array_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\compass;
#using scripts\shared\exploder_shared;
#using scripts\shared\flag_shared;
#using scripts\shared\laststand_shared;
#using scripts\shared\math_shared;
#using scripts\shared\scene_shared;
#using scripts\shared\util_shared;

#insert scripts\shared\shared.gsh;
#insert scripts\shared\version.gsh;

#insert scripts\zm\_zm_utility.gsh;

#using scripts\zm\_load;
#using scripts\zm\_zm;
#using scripts\zm\_zm_audio;
#using scripts\zm\_zm_powerups;
#using scripts\zm\_zm_utility;
#using scripts\zm\_zm_weapons;
#using scripts\zm\_zm_zonemgr;

#using scripts\shared\ai\zombie_utility;

//Perks
#using scripts\zm\_zm_pack_a_punch;
#using scripts\zm\_zm_pack_a_punch_util;
#using scripts\zm\_zm_perk_additionalprimaryweapon;
#using scripts\zm\_zm_perk_doubletap2;
#using scripts\zm\_zm_perk_deadshot;
#using scripts\zm\_zm_perk_juggernaut;
#using scripts\zm\_zm_perk_quick_revive;
#using scripts\zm\_zm_perk_sleight_of_hand;
#using scripts\zm\_zm_perk_staminup;

//Powerups
#using scripts\zm\_zm_powerup_double_points;
#using scripts\zm\_zm_powerup_carpenter;
#using scripts\zm\_zm_powerup_fire_sale;
#using scripts\zm\_zm_powerup_free_perk;
#using scripts\zm\_zm_powerup_full_ammo;
#using scripts\zm\_zm_powerup_insta_kill;
#using scripts\zm\_zm_powerup_nuke;
//#using scripts\zm\_zm_powerup_weapon_minigun;

//Traps
#using scripts\zm\_zm_trap_electric;

#using scripts\zm\zm_usermap;

    // NSZ Brutus
    #using scripts\_NSZ\nsz_brutus;

//*****************************************************************************
// MAIN
//*****************************************************************************

function main()
{
    // NSZ Brutus
    brutus::init();

    zm_usermap::main();

    //Teleport player
    thread player_teleporter_init();
   
    level._zombie_custom_add_weapons =&custom_add_weapons;
   
    //Setup the levels Zombie Zone Volumes
    level.zones = [];
    level.zone_manager_init_func =&usermap_test_zone_init;
    init_zones[0] = "start_zone";
    level thread zm_zonemgr::manage_zones( init_zones );

    level.pathdist_type = PATHDIST_ORIGINAL;

    //Brutus Boss fight
    thread brutus_doo_dah();
}

function usermap_test_zone_init()
{
    level flag::init( "always_on" );
    level flag::set( "always_on" );
}  

function custom_add_weapons()
{
    zm_weapons::load_weapon_spec_from_table("gamedata/weapons/zm/zm_levelcommon_weapons.csv", 1);
}

//Brutus Boss Fight
function brutus_doo_dah()
{
    level.brutuses = 14; //amount of brutuses to spawn
    level.brutus_in_between_spawn_time = 30; //time between spawns for Brutus. If you're only spawning one Brutus, set this to 0.
    level.stop_zombies_from_spawning = false; //set "true" to stop zombies from spawning during Brutus fight.
    level.kill_all_zombies_before_fight = true; //set "true" to kill all zombies before Brutus fight.

    level.brutus_reward = "door"; //what happens when you kill all the Brutuses. Right now, options are: ("door","powerup","gun")
    level.brutus_reward_2 = false; //add another reward if you want. just say "false" or delete the line if you don't want an extra reward.
    level.brutus_reward_3 = false; //add yet another reward if you want. Note that you cannot do more than one of the same reward.
    level.brutus_powerup_type = "nuke"; //if using a powerup as one of your rewards, this is what type. can be ("full_ammo","nuke","insta_kill","free_perk","fire_sale","double_points","carpenter","minigun",and "random")
    level.brutus_reward_weapons = array( "ar_damage", "lmg_cqb", "shotgun_pump", "smg_versatile" ); //weapons it can give you in the "gun" reward. put as many or as little as you like.
    level.brutus_gun_expire = true; //whether or not the gun will go away in time.
    level.brutus_delete_door_after_move = true; //set "true" to delete the door after its done moving. Would recommend if it won't be seen.
    level.brutus_gun_hintstring = "Press ^3[{+activate}]^7 to take weapon"; //if gun reward is activated, hintstring for picking up gun.
    level.brutus_one_gun_per_player = true; //for gun powerup, set "true" if you want a gun to spawn for each player, "false" for just one gun no matter what.
    level.brutus_different_guns_per_player = false; //for gun powerup, set "true" if you want each gun to be randomly different, false if you want them to be the same random gun. if one_gun_per_player = "false" this doesn't matter.
   
   
    trig = GetEnt("brutus_trig","targetname");
    trig waittill("trigger",player);
    if(level.stop_zombies_from_spawning == true)
        level flag::clear( "spawn_zombies" );
    if(level.kill_all_zombies_before_fight == true)
    {
        zombies = zombie_utility::get_round_enemy_array();
        if ( isdefined( zombies ) )
        {
            array::run_all( zombies, &Kill );
        }
    }
   
   
    thread spawn_my_brutus();  
   
   
   
    level waittill("all_brutuses_down");
    //IPrintLnBold("recieved");
    if(level.stop_zombies_from_spawning == true)
        level flag::set( "spawn_zombies" );
    brutus_reward();
}
function spawn_my_brutus()
{
    brutus_spawners =  struct::get_array("brutus_arena_spawn","targetname");
    for(i=0;i<level.brutuses;i++)
    {
        rand = RandomIntRange( 0, brutus_spawners.size );
        brutus_spawners[rand] thread brutus::arena_spawn_brutus();
        wait(level.brutus_in_between_spawn_time);
    }
}
function brutus_reward()
{
    //IPrintLnBold("brutus_reward");
    if(level.brutus_reward == "door" || level.brutus_reward_2 == "door" || level.brutus_reward_3 == "door")
    {
        //IPrintLnBold("door reward");
        time = 2; //2 is amount of time in seconds door takes to move.
        door_parts = GetEntArray("brutus_door","targetname");
        for(i=0;i<door_parts.size;i++)
        {
            target = Struct::Get(door_parts[i].target,"targetname");
            if(isdefined(target))
                door_parts[i] MoveTo(target.origin, time);
            if(isdefined(door_parts[i].script_vector))
                door_parts[i] MoveTo(door_parts[i].origin + (door_parts[i].script_vector), time);
        }
        wait(time);
       
        if(level.brutus_delete_door_after_move == true)
        {
            for(i=0;i<door_parts.size;i++)
            {
               
                door_parts[i] Delete();
            }
        }
    }
    if(level.brutus_reward == "powerup" || level.brutus_reward_2 == "powerup" || level.brutus_reward_3 == "powerup")
    {
        powerup_struct = GetEnt("brutus_powerup_struct","targetname");
        if(level.brutus_powerup_type != "random")
            thread zm_powerups::specific_powerup_drop( level.brutus_powerup_type, powerup_struct.origin);
        if(level.brutus_powerup_type == "random")
        {
            rand = RandomIntRange( 0, 7 ); //("full_ammo","nuke","insta_kill","free_perk","fire_sale","double_points","carpenter","minigun")
            if(rand == 0)
                thread zm_powerups::specific_powerup_drop( "full_ammo", powerup_struct.origin);
            if(rand == 1)
                thread zm_powerups::specific_powerup_drop( "nuke", powerup_struct.origin);
            if(rand == 2)
                thread zm_powerups::specific_powerup_drop( "insta_kill", powerup_struct.origin);
            if(rand == 3)
                thread zm_powerups::specific_powerup_drop( "free_perk", powerup_struct.origin);
            if(rand == 4)
                thread zm_powerups::specific_powerup_drop( "fire_sale", powerup_struct.origin);
            if(rand == 5)
                thread zm_powerups::specific_powerup_drop( "double_points", powerup_struct.origin);
            if(rand == 6)
                thread zm_powerups::specific_powerup_drop( "carpenter", powerup_struct.origin);
            if(rand == 7)
                thread zm_powerups::specific_powerup_drop( "minigun", powerup_struct.origin);
        }
    }
    if(level.brutus_reward == "gun" || level.brutus_reward_2 == "gun" || level.brutus_reward_3 == "gun")
    {
        //IPrintLnBold("gun reward");
        if(level.brutus_one_gun_per_player == false)
            gun_struct = struct::get("brutus_gun_struct","targetname");
            thread brutus_RewardGun(gun_struct.origin+(0,0,40), array::randomize(level.brutus_reward_weapons)[0]);
        if(level.brutus_one_gun_per_player == true && level.brutus_different_guns_per_player == true)
        {
            gun_structs = struct::get_array("brutus_gun_struct","targetname");
            players = GetPlayers();
            for(i=0;i<players.size;i++)
            {
                thread brutus_RewardGun(gun_structs[i].origin+(0,0,40), array::randomize(level.brutus_reward_weapons)[0]);
            }
        }
        if(level.brutus_one_gun_per_player == true && level.brutus_different_guns_per_player == false)
        {
            rand = RandomIntRange( 0, level.brutus_reward_weapons.size );
            gun_structs = struct::get_array("brutus_gun_struct","targetname");
            players = GetPlayers();
            for(i=0;i<players.size;i++)
            {
                thread brutus_RewardGun(gun_structs[i].origin+(0,0,40), level.brutus_reward_weapons[rand]);
            }
        }
    }
}
function brutus_RewardGun(pos, weapon)
{
    gun = spawn("script_model", pos);
    playsoundatposition("zmb_spawn_powerup", pos);
   
    gun SetModel(GetWeaponWorldModel(GetWeapon(weapon)));
    PlayFX(level._effect["powerup_grabbed_solo"], gun.origin);
    trig = spawn("trigger_radius", gun.origin, 0, 20, 50);
    gun thread brutus_SpinMe();
    gun thread brutus_GiveMe(weapon, trig);
    if(level.brutus_gun_expire == true)
        gun thread brutus_LifeTime(trig);
}
function brutus_LifeTime(trig)
{
    self endon("death");
    wait(120);//wait 2 minutes then delete
    if(isdefined(self))
    {
        self notify("rewardgun_delete");
    }
    if(isdefined(trig))
    {
        trig delete();
    }
    if(isdefined(self))
    {
        self delete();
    }
}
function brutus_GiveMe(weapon, trig)
{
    self endon("rewardgun_delete");
    while(1)
    {
        trig waittill("trigger", player);
        player thread brutus_SetGunHint(level.brutus_gun_hintstring, trig);
        if(player HasWeapon(getweapon("minigun")))
        {
            continue;
        }
        if(!(player UseButtonPressed()))
        {
            continue;
        }
        if(player laststand::player_is_in_laststand())
        {
            continue;
        }
        trig delete();
        self delete();
        player zm_weapons::weapon_give(getweapon(weapon));
        player SwitchToWeapon(getweapon(weapon));
        break;
        wait(.1);
    }
}

function brutus_SpinMe()
{
    self endon("rewardgun_delete");
    self endon("death");
    while(isdefined(self))
    {
        if(isdefined(self))
        {
            self rotateyaw(360,2);
        }
        wait(1.9);
    }
}
function brutus_SetGunHint(text, trig)
{
    if(isdefined(self.brutus_gun_hud))
    {
        return;
    }
    self.brutus_gun_hud = NewClientHudElem( self );
    self.brutus_gun_hud.horzAlign = "center";
    self.brutus_gun_hud.vertAlign = "middle";
    self.brutus_gun_hud.alignX = "center";
    self.brutus_gun_hud.alignY = "middle";
    self.brutus_gun_hud.foreground = 1;
    self.brutus_gun_hud.fontscale = 1;
    self.brutus_gun_hud.alpha = 1;
    self.brutus_gun_hud.color = ( 0.44, .74, .94 );
    self.brutus_gun_hud SetText(text);
    while(isdefined(trig) && self IsTouching(trig))
    {
        wait(.05);
    }
    self.brutus_gun_hud SetText("");
    self.brutus_gun_hud Destroy();
    self.brutus_gun_hud = undefined;
}


//Teleport player
function player_teleporter_init()
{
    player_tp = GetEntArray( "teleport_player", "targetname" );
    for( i = 0; i < player_tp.size; i++ )
    {
        player_tp[i] thread player_teleport();
    }
}

function player_teleport()
{
    destination = GetEnt( self.target, "targetname" );
    while(1)
    {
        self waittill( "trigger", player );
        player SetOrigin( destination.origin );
        player SetPlayerAngles( destination.angles );
    }
}


Use a Script/Struct/Origin, and select ServerSide.

Harry Bo21:

He’s using getEnt but telling you to place a struct...

change the struct to a script origin


Pepergogo:

Yeah I was using a struct and change to origin, set to ServerSide and now it's working just fine

Thanks [USER=615]@eDeK[/USER] and [USER=147]@Harry Bo21[/USER] :D


KillJoy:

ah my bad 😬


Pepergogo:

ah my bad 😬

Np
One question, do you know if I can use multiple script_origin so when multiple players touch the trigger they appear in them insted in just 1 location?

mrlednor:

Np
One question, do you know if I can use multiple script_origin so when multiple players touch the trigger they appear in them insted in just 1 location?

hay did u get this to work with multiple script origin ? thanks

Pepergogo:

hay did u get this to work with multiple script origin ? thanks

I found the solution by [USER=75]@IceGrenade[/USER] in a Discord server

Haven't test it yet but I took a screenshot if you want to try it

mrlednor:

I found the solution by [USER=75]@IceGrenade[/USER] in a Discord server

Haven't test it yet but I took a screenshot if you want to try it

thanks