Jump to content
oxocube3

Team assignment based on GUID.

Recommended Posts

So I'm at the point where the skeleton of my server is set up, and I'm hanging the meat on the bones. I'm looking to add assignments to players based on their unique GUID. any ideas on whether this is possible, as user info is saved based on current character/bans etc.

for clarity, the reason for this implementation is not to give an unfair advantage. I'm thinking of team based scenarios. (attack vs defend - Cops vs robbers - blue vs red etc).

Hoping to be able to tie spawns and load outs to users based on predetermined data.

Share this post


Link to post
Share on other sites

You can retrieve a players BI UID by

string uid = player.GetIdentity().GetId();

 

Share this post


Link to post
Share on other sites

It's easier to use their Steam64 id.

https://guid2steamid.com/ to get their Steam64 from their GUID (to get player steam64 from dart/etc).

player.GetIdentity().GetPlainId()

player.GetIdentity().GetId() is NOT their BE GUID, it's different hash completely

Edited by Aussie Cleetus

Share this post


Link to post
Share on other sites

Great, thanks for the input - so using the Steam 64 ID my question still stands. hopefully I can have a check on when specific players join, they will be assigned a role that is attached to their ID.

Share this post


Link to post
Share on other sites
Switch(player.GetIdentity().GetPlainId()){
    case "user1steam64id":
        // -- insert your group assignment
        break;
    case "user2steam64id":
        // -- insert your group assignment
        break;
}

 

  • Thanks 1

Share this post


Link to post
Share on other sites

 

short question,

I have "Switch(player.GetIdentity().GetPlainId())" changed in "Switch(player.GetIdentity().GetName())"

 

if now player 1 TeamRed (case "TeamRed":) joint, and Player 2 too TeamRed (2) 

only player 1 gets the gear because player 2 has the wrong name (TeamRed (2)) how do I have to change "case" TeamRed ":" that it works ?

 

Edited by SaarPlayTV

Share this post


Link to post
Share on other sites

if you try to use "name", the player has to set their name using Launch Parameters in Steam to the right things.

Switch(player.GetIdentity().GetName()){
    case "Redteam":
        //this player's name is "Redteam" so assign them to red team
        break;
    case "Blueteam":
        //this player's name is "Blueteam" so assign them to blue team
        break;
    default:
        //this player's name is not set in Steam Launch Parameters, we should probably assign a random team to them
        break;
}

 

Share this post


Link to post
Share on other sites

 

It's about the first player named TeamRed and the second TeamRed (2)

that the name can only be given once, but he only asks for the name TeamRed and not TeamRed (2)

Share this post


Link to post
Share on other sites
switch(player.GetIdentity().GetName()){
	case "TeamBlau": case "TeamBlau (2)": case "TeamBlau (3)": case "TeamBlau (4)":

 

shorten that here

Share this post


Link to post
Share on other sites
On ‎11‎.‎10‎.‎2018 at 11:27 PM, Aussie Cleetus said:

Switch(player.GetIdentity().GetPlainId()){
    case "user1steam64id":
        // -- insert your group assignment
        break;
    case "user2steam64id":
        // -- insert your group assignment
        break;
}

 

What is the point in init.c?

Share this post


Link to post
Share on other sites
1 hour ago, ulli_123 said:

What is the point in init.c?

I personally use it for personalized spawn loadouts for Admins (including their identifying armband). This way if someone is on the coast and they are out West, they can take a quick trip to the coast to deal with the situation. As a PvE server, I find that it's important for admins to be able to quickly and relatively painlessly do so.

Share this post


Link to post
Share on other sites
8 hours ago, Aussie Cleetus said:

I personally use it for personalized spawn loadouts for Admins (including their identifying armband). This way if someone is on the coast and they are out West, they can take a quick trip to the coast to deal with the situation. As a PvE server, I find that it's important for admins to be able to quickly and relatively painlessly do so.

I think I've mispronounced myself, I want to know where the code comes from in init.c
I tried so hard to test, but there is an error message when I start the server.


void main()
{

	Hive ce = CreateHive();
	if ( ce )
		ce.InitOffline();

	Weather weather = g_Game.GetWeather();

	weather.GetOvercast().SetLimits( 0.0 , 1.0 );
	weather.GetRain().SetLimits( 0.0 , 1.0 );
	weather.GetFog().SetLimits( 0.0 , 0.25 );

	weather.GetOvercast().SetForecastChangeLimits( 0.0, 0.2 );
	weather.GetRain().SetForecastChangeLimits( 0.0, 0.1 );
	weather.GetFog().SetForecastChangeLimits( 0.15, 0.45 );

	weather.GetOvercast().SetForecastTimeLimits( 1800 , 1800 );
	weather.GetRain().SetForecastTimeLimits( 600 , 600 );
	weather.GetFog().SetForecastTimeLimits( 1800 , 1800 );

	weather.GetOvercast().Set( Math.RandomFloatInclusive(0.0, 0.3), 0, 0);
	weather.GetRain().Set( Math.RandomFloatInclusive(0.0, 0.2), 0, 0);
	weather.GetFog().Set( Math.RandomFloatInclusive(0.0, 0.1), 0, 0);
	
	weather.SetWindMaximumSpeed(15);
	weather.SetWindFunctionParams(0.1, 0.3, 50);
}

class CustomMission: MissionServer
{
void SetRandomHealth(EntityAI itemEnt)
{
int rndHlt = Math.RandomInt(60,100);
itemEnt.SetHealth("","",rndHlt);
} 
override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
{
Entity playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");
Class.CastTo(m_player, playerEnt);
GetGame().SelectPlayer(identity, m_player); 
return m_player;
} 
override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
{
player.RemoveAllItems(); 
EntityAI itemEnt;
ItemBase itemBs; 

  Switch (player.GetIdentity().GetPlainId()){
    case "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx":
        player.GetInventory().CreateInInventory("TTSKOPants");itemBs = ItemBase.Cast(itemEnt);
		player.GetInventory().CreateInInventory("TShirt_Green");itemBs = ItemBase.Cast(itemEnt);
		player.GetInventory().CreateInInventory("CombatBoots_Black");itemBs = ItemBase.Cast(itemEnt);
		player.GetInventory().CreateInInventory("CombatKnife");itemBs = ItemBase.Cast(itemEnt);
		player.GetInventory().CreateInInventory("Barrel_Green");itemBs = ItemBase.Cast(itemEnt);
        break;
    case "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx":
        player.GetInventory().CreateInInventory("ParamedicPants_Green");itemBs = ItemBase.Cast(itemEnt);
		player.GetInventory().CreateInInventory("ParamedicJacket_Green");itemBs = ItemBase.Cast(itemEnt);
		player.GetInventory().CreateInInventory("KitchenKnife");itemBs = ItemBase.Cast(itemEnt);
		player.GetInventory().CreateInInventory("SalineBagIV");itemBs = ItemBase.Cast(itemEnt);
		player.GetInventory().CreateInInventory("BandageDressing");itemBs = ItemBase.Cast(itemEnt);
		player.GetInventory().CreateInInventory("Barrel_Green");itemBs = ItemBase.Cast(itemEnt);
        break;
}

// Give universal gear
itemEnt = player.GetInventory().CreateInInventory("Rag");
itemBs = ItemBase.Cast(itemEnt);
itemBs.SetQuantity(4);
}
};
Mission CreateCustomMission(string path)
{
return new CustomMission();
}  

 

Share this post


Link to post
Share on other sites

You're not emptying the person of gear before trying to add clothes. That alone will cause problems. When I get to my computer, I'll post an example of how I do custom loadouts for players based on their steam64id.

Share this post


Link to post
Share on other sites
class CustomMission: MissionServer {
    override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName) {
        Entity playerEnt;
        playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
        Class.CastTo(m_player, playerEnt);
        
        GetGame().SelectPlayer(identity, m_player);
        
        return m_player;
    }
    
    void CustomMission() {
    }

    override void StartingEquipSetup(PlayerBase player, bool clothesChosen) {
        EntityAI primary;
        EntityAI itemEnt;
        EntityAI gun;
        ItemBase itemBs;
        EntityAI optic_attach;
        
        switch(player.GetIdentity().GetPlainId()) {
            // Admin 1 Loadout
            case "XXXXXXXX":
                player.RemoveAllItems();
                
                addItem(itemEnt, itemBs, player, "TTsKOJacket_Camo", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "TTSKOPants", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "JungleBoots_Green", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "BallisticHelmet_Green", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "ThinFramesGlasses", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "SmershVestBackpack", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "Armband_Blue", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "TacticalGloves_Green", 1, 0, -1);                
                addItem(itemEnt, itemBs, player, "TortillaBag", 1, 0, -1);
                
                addItem(itemEnt, itemBs, player, "Pear", 10, 0, -1);
                addItem(itemEnt, itemBs, player, "CombatKnife", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "Rag", 3, 6, -1);
                addItem(itemEnt, itemBs, player, "Pot", 1, 2000, -1);
                addItem(itemEnt, itemBs, player, "BloodTestKit", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "FirefighterAxe_Green", 1, 0, 0);
                
                addItem(itemEnt, itemBs, player, "Mag_AKM_Drum75Rnd_Green", 1, 1, 2);
                addItem(itemEnt, itemBs, player, "Mag_AKM_Drum75Rnd_Green", 1, 1, 3);
                addItem(itemEnt, itemBs, player, "Mag_AKM_Drum75Rnd_Green", 1, 1, 4);
                addItem(itemEnt, itemBs, player, "Mag_AKM_Drum75Rnd_Green", 1, 1, -1);
                addItem(itemEnt, itemBs, player, "Ammo_762x39", 1, 1, -1);
                addItem(itemEnt, itemBs, player, "KobraOptic", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "Battery9V", 2, 0, -1);
                addItem(itemEnt, itemBs, player, "Matchbox", 1, 0, -1);
            
                primary = akmClass(player, itemBs, gun, itemEnt, optic_attach);
                itemBs = ItemBase.Cast(primary);
                player.SetQuickBarEntityShortcut(primary, 1, true);
                                
                break;
            // Admin 2 Loadout
            case "XXXXXXXX":
                player.RemoveAllItems();
                
                addItem(itemEnt, itemBs, player, "USMCJacket_Woodland", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "USMCPants_Woodland", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "JungleBoots_Green", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "CowboyHat_green", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "DesignerGlasses", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "SmershVestBackpack", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "Armband_Blue", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "TacticalGloves_Green", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "AssaultBag_Ttsko", 1, 0, -1);
                
                addItem(itemEnt, itemBs, player, "Pear", 10, 0, -1);
                addItem(itemEnt, itemBs, player, "CombatKnife", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "Rag", 3, 6, -1);
                addItem(itemEnt, itemBs, player, "Pot", 1, 2000, -1);
                addItem(itemEnt, itemBs, player, "BloodTestKit", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "FirefighterAxe_Green", 1, 0, 1);
                
                addItem(itemEnt, itemBs, player, "Mag_AKM_30Rnd", 1, 1, 2);
                addItem(itemEnt, itemBs, player, "Mag_AKM_30Rnd", 1, 1, 3);
                addItem(itemEnt, itemBs, player, "Mag_AKM_30Rnd", 1, 1, 4);
                addItem(itemEnt, itemBs, player, "Mag_AKM_30Rnd", 1, 1, 5);
                addItem(itemEnt, itemBs, player, "Mag_AKM_30Rnd", 1, 1, 6);
                addItem(itemEnt, itemBs, player, "Mag_AKM_30Rnd", 1, 1, 7);
                addItem(itemEnt, itemBs, player, "Mag_AKM_30Rnd", 1, 1, -1);
                addItem(itemEnt, itemBs, player, "Ammo_762x39", 1, 1, -1);
                addItem(itemEnt, itemBs, player, "KobraOptic", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "Battery9V", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "Matchbox", 1, 0, -1);
            
                primary = akmClass(player, itemBs, gun, itemEnt, optic_attach);
                itemBs = ItemBase.Cast(primary);
                player.SetQuickBarEntityShortcut(primary, 0, true);
                
                break;
            // Admin 3 Loadout
            case "XXXXXXXX":
                player.RemoveAllItems();
                
                addItem(itemEnt, itemBs, player, "M65Jacket_Black", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "CargoPants_Black", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "JungleBoots_Black", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "BallisticHelmet_Black", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "DesignerGlasses", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "Armband_Blue", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "HighCapacityVest_Black", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "TacticalGloves_Black", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "AliceBag_Black", 1, 0, -1);
                
                addItem(itemEnt, itemBs, player, "Pear", 10, 0, -1);
                addItem(itemEnt, itemBs, player, "CombatKnife", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "Rag", 3, 6, -1);
                addItem(itemEnt, itemBs, player, "Pot", 1, 2000, -1);
                addItem(itemEnt, itemBs, player, "BloodTestKit", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "FirefighterAxe", 1, 0, 1);
                
                addItem(itemEnt, itemBs, player, "Mag_AKM_Drum75Rnd_Black", 1, 1, 2);
                addItem(itemEnt, itemBs, player, "Mag_AKM_Drum75Rnd_Black", 1, 1, 3);
                addItem(itemEnt, itemBs, player, "Mag_AKM_Drum75Rnd_Black", 1, 1, 4);
                addItem(itemEnt, itemBs, player, "Ammo_762x39", 1, 1, -1);
                addItem(itemEnt, itemBs, player, "KobraOptic", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "Battery9V", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "Matchbox", 1, 0, -1);
            
                primary = akmClass(player, itemBs, gun, itemEnt, optic_attach);
                itemBs = ItemBase.Cast(primary);
                player.SetQuickBarEntityShortcut(primary, 0, true);
                
                break;
            // Admin 4 Loadout
            case "XXXXXXXX":
                addItem(itemEnt, itemBs, player, "SmershBag", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "Pear", 2, 0, -1);
                addItem(itemEnt, itemBs, player, "StoneKnife", 1, 0, 1);
                addItem(itemEnt, itemBs, player, "Rag", 1, 6, 2);
                addItem(itemEnt, itemBs, player, "WoodAxe", 1, 0, 0);
                addItem(itemEnt, itemBs, player, "Armband_Blue", 1, 0, 0);
                
                break;
            // Admin 5 Loadout
            case "XXXXXXXX":
                player.RemoveAllItems();
                addItem(itemEnt, itemBs, player, "TacticalShirt_Black", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "CargoPants_Green", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "CombatBoots_Black", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "BaseballCap_CMMG_Black", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "DesignerGlasses", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "Armband_Blue", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "SmershVestBackpack", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "HuntingBag", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "TacticalGloves_Black", 1, 0, -1);
                
                addItem(itemEnt, itemBs, player, "Pear", 10, 0, -1);
                addItem(itemEnt, itemBs, player, "CombatKnife", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "Rag", 1, 6, -1);
                addItem(itemEnt, itemBs, player, "FirefighterAxe_Green", 1, 0, 0);
                addItem(itemEnt, itemBs, player, "Armband_Blue", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "Compass", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "OrienteeringCompass", 1, 0, -1);
                
                addItem(itemEnt, itemBs, player, "Mag_UMP_25Rnd", 1, 1, 2);
                addItem(itemEnt, itemBs, player, "Mag_UMP_25Rnd", 1, 1, 3);
                addItem(itemEnt, itemBs, player, "Mag_UMP_25Rnd", 1, 1, 4);
                addItem(itemEnt, itemBs, player, "Mag_UMP_25Rnd", 1, 1, 5);
                addItem(itemEnt, itemBs, player, "Mag_UMP_25Rnd", 1, 1, 6);
            
                primary = usgClass(player, itemBs, gun, itemEnt, optic_attach);
                itemBs = ItemBase.Cast(primary);
                player.SetQuickBarEntityShortcut(primary, 1, true);
                
                break;
            // Admin 6 Loadout
            case "XXXXXXXX":
                player.RemoveAllItems();
                addItem(itemEnt, itemBs, player, "LeatherJacket_Black", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "LeatherPants_Black", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "HikingBoots_Brown", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "LeatherStorageVest_Black", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "Armband_Blue", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "CowboyHat_darkBrown", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "WorkingGloves_Brown", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "FurImprovisedBag", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "Pear", 2, 0, -1);
                addItem(itemEnt, itemBs, player, "StoneKnife", 1, 0, 1);
                addItem(itemEnt, itemBs, player, "Rag", 1, 6, 2);
                addItem(itemEnt, itemBs, player, "WoodAxe", 1, 0, 0);
                addItem(itemEnt, itemBs, player, "Compass", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "OrienteeringCompass", 1, 0, -1);
                
                addItem(itemEnt, itemBs, player, "Mag_UMP_25Rnd", 1, 1, 2);
                addItem(itemEnt, itemBs, player, "Mag_UMP_25Rnd", 1, 1, 3);
                addItem(itemEnt, itemBs, player, "Mag_UMP_25Rnd", 1, 1, 4);
                addItem(itemEnt, itemBs, player, "Mag_UMP_25Rnd", 1, 1, 5);
                addItem(itemEnt, itemBs, player, "Mag_UMP_25Rnd", 1, 1, 6);
                
                primary = usgClass(player, itemBs, gun, itemEnt, optic_attach);
                itemBs = ItemBase.Cast(primary);
                player.SetQuickBarEntityShortcut(primary, 1, true);
                break;
            // Default Player Loadout
            default:
                addItem(itemEnt, itemBs, player, "SmershBag", 1, 0, -1);
                addItem(itemEnt, itemBs, player, "Pear", 2, 0, -1);
                addItem(itemEnt, itemBs, player, "StoneKnife", 1, 0, 1);
                addItem(itemEnt, itemBs, player, "Rag", 1, 6, 2);
                addItem(itemEnt, itemBs, player, "WoodAxe", 1, 0, 0);
                
                break;
        }
    }

    void addItem(EntityAI itemEnt, ItemBase itemBs, PlayerBase player, string item_name, int count, int stackSize, int invSlot) {
        for (int i = 0; i < count; i++) {
            itemEnt = player.GetInventory().CreateInInventory(item_name);
            itemBs = ItemBase.Cast(itemEnt);
            if (stackSize > 0) {
                itemBs.SetQuantity(stackSize);
            }
            if (invSlot >= 0 || invSlot <= 9) {
                player.SetQuickBarEntityShortcut(itemEnt, invSlot, true);
            }
        }
    }

    EntityAI akmClass(PlayerBase player, ItemBase itemBs, EntityAI gun, EntityAI itemEnt, EntityAI optic_attach) {
        gun = player.GetHumanInventory().CreateInHands("AKM");
        gun.GetInventory().CreateAttachment("AK_WoodHndgrd");
        gun.GetInventory().CreateAttachment("AK_Woodbttstck");
        gun.GetInventory().CreateAttachment("AK_Suppressor");
        optic_attach = gun.GetInventory().CreateAttachment("PSO1Optic");
        optic_attach.GetInventory().CreateAttachment("Battery9V");
        itemBs = ItemBase.Cast(gun);
        
        return gun;
    }
    
    EntityAI m4a1Class(PlayerBase player, ItemBase itemBs, EntityAI gun, EntityAI itemEnt, EntityAI optic_attach) {
        gun = player.GetHumanInventory().CreateInHands("M4A1_Green");
        gun.GetInventory().CreateAttachment("M4_PlasticHndgrd");
        gun.GetInventory().CreateAttachment("M4_OEBttstck");
        gun.GetInventory().CreateAttachment("M4_Suppressor");
        optic_attach = gun.GetInventory().CreateAttachment("ACOGOptic");
        itemBs = ItemBase.Cast(gun);
        
        return gun;
    }
    
    EntityAI usgClass(PlayerBase player, ItemBase itemBs, EntityAI gun, EntityAI itemEnt, EntityAI optic_attach) {
        gun = player.GetHumanInventory().CreateInHands("UMP45");
        gun.GetInventory().CreateAttachment("PistolSuppressor");
        optic_attach = gun.GetInventory().CreateAttachment("M68Optic");
        optic_attach.GetInventory().CreateAttachment("Battery9V");
        itemBs = ItemBase.Cast(gun);
        
        return gun;
    }
}

void main() {

    Hive ce = CreateHive();
    if ( ce )
        ce.InitOffline();

    Weather weather = g_Game.GetWeather();

    weather.GetOvercast().SetLimits(0, 0);
    weather.GetRain().SetLimits(0, 0);
    weather.GetFog().SetLimits(0, 0);

    weather.GetOvercast().SetForecastChangeLimits(0, 0);
    weather.GetRain().SetForecastChangeLimits(0, 0);
    weather.GetFog().SetForecastChangeLimits(0, 0);

    weather.GetOvercast().SetForecastTimeLimits(0, 0);
    weather.GetRain().SetForecastTimeLimits(0, 0);
    weather.GetFog().SetForecastTimeLimits(0, 0);

    weather.GetOvercast().Set(0, 0, 0);
    weather.GetRain().Set(0, 0, 0);
    weather.GetFog().Set(0, 0, 0);
    
    weather.SetWindMaximumSpeed(15);
    weather.SetWindFunctionParams(0.1, 0.3, 50);
}
  
Mission CreateCustomMission(string path) {
    return new CustomMission();
}

 

Added bonus in here is my (until now) unreleased AddItem Function to make it easier to add items to players.

Allows choosing:

  • number of stacks
  • number of items per stack
  • hotkey assignment for item (requires adding a single item instance for each hotkey desired - see how Magazines are added in the Admin Loadouts)
Edited by Aussie Cleetus
  • Like 3

Share this post


Link to post
Share on other sites

switch(player.GetIdentity().GetPlainId()) { // Admin 1 Loadout case "XXXXXXXX":

Is the XXXXX is where you would enter the admins 64 ID?

Also if you wanted two admins 64 IDs accosicate to the same loadout case can would you use the below format? 

// Admin 1 Loadout case "XXXXXXXX","XXXXXXXX":

Thanks for help Aussie, I’ve been watching this thread :) 

Share this post


Link to post
Share on other sites
6 hours ago, Fester808 said:

switch(player.GetIdentity().GetPlainId()) { // Admin 1 Loadout case "XXXXXXXX":

Is the XXXXX is where you would enter the admins 64 ID?

Also if you wanted two admins 64 IDs accosicate to the same loadout case can would you use the below format? 

// Admin 1 Loadout case "XXXXXXXX","XXXXXXXX":

Thanks for help Aussie, I’ve been watching this thread :) 

yes, the XXXXXXXX is the steam64id

 

to be completely honest, I doubt Bohemia put in multiple allowed case choices per option. If there is a common loadout, I would wrap that loadout in a method and then call the method for each of the players' steam64id case.

Edited by Aussie Cleetus
  • Like 1

Share this post


Link to post
Share on other sites
// New Additional method to accompany my addItem method
// Usage: AddPlayerClothes(player, "HelmetName", "GlassesName", "MaskName", "ShirtName", "VestName", "BeltName", "PantsName", "BootsName", "BackPackName", itemBs, itemEnt);
// To not send an item to the player, make the string empty: ""   (make sure to keep both quotes)
void AddPlayerClothes(Playerbase _player=null, string _helmet="", string _glasses="", string _mask="", string _shirt="", string _vest="", string _belt="", string _pants="", string _boots="", string _backpack="", ItemBase _itemBs=null, EntityAI _itemEnt=null) {
    if (player != null && itemBs != null && itemEnt != null) {
        if (_helmet != "") {
            addItem(_itemEnt, _itemBs, _player, _helmet, 1, 0, -1);
        }
        if (_glasses != "") {
            addItem(_itemEnt, _itemBs, _player, _glasses, 1, 0, -1);
        }
        if (_mask != "") {
            addItem(_itemEnt, _itemBs, _player, _mask, 1, 0, -1);
        }
        if (_shirt != "") {
            addItem(_itemEnt, _itemBs, _player, _shirt, 1, 0, -1);
        }
        if (_vest != "") {
            addItem(_itemEnt, _itemBs, _player, _vest, 1, 0, -1);
        }
        if (_belt != "") {
            addItem(_itemEnt, _itemBs, _player, _belt, 1, 0, -1);
        }
        if (_pants != "") {
            addItem(_itemEnt, _itemBs, _player, _pants, 1, 0, -1);
        }
        if (_boots != "") {
            addItem(_itemEnt, _itemBs, _player, _boots, 1, 0, -1);
        }
        if (_backpack != "") {
            addItem(_itemEnt, _itemBs, _player, _backpack, 1, 0, -1);
        }
    }
}

void addItem(EntityAI itemEnt=null, ItemBase itemBs=null, PlayerBase player=null, string item_name="", int count=0, int stackSize=0, int invSlot=-1) {
    if (player != null && itemBs != null && itemEnt != null && item_name != "") {
        for (int i = 0; i < count; i++) {
            itemEnt = player.GetInventory().CreateInInventory(item_name);
            itemBs = ItemBase.Cast(itemEnt);
            if (stackSize > 0) {
                itemBs.SetQuantity(stackSize);
            }
            if (invSlot >= 0 || invSlot <= 9) {
                player.SetQuickBarEntityShortcut(itemEnt, invSlot, true);
            }
        }
    }
}

This may help some people.

I've tried to add some defaults for fields and some basic fool-proofing.

Edited by Aussie Cleetus
  • Like 2

Share this post


Link to post
Share on other sites

The line that has case "XXXXXXXXXXXXXXXXXX": always causes an error.

this is the warning message.

 

Can't compile mission init script"!

chernarusplus\init.c(63): Broken expression (missing';'?)

Share this post


Link to post
Share on other sites
On 10/31/2018 at 5:53 PM, Dongleberry said:

The line that has case "XXXXXXXXXXXXXXXXXX": always causes an error.

this is the warning message.

 

Can't compile mission init script"!

chernarusplus\init.c(63): Broken expression (missing';'?)

Replace : with ;

"XXXXXXXXXXXXXXXXXX";

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×