Beiträge von imidazon
-
-
Der Fehler war in Zeile 47, die Klamotten wurden immer entfernt.
Zudem sollte es jetzt auch mit 6 Admins laufen, nicht schön programmiert, aber hab gerade nicht viel Zeit.
Wenn man die Anzahl der Admins universell haben möchte schreibe ich am Wochenende noch schnell eine Schleife die das regelt. (in C leider nicht so easy wie in anderen Programmiersprachen)
C: init.c
Alles anzeigenclass CustomMission: MissionServer { void SetRandomHealth(EntityAI itemEnt) { if ( itemEnt ) { int rndHlt = Math.RandomInt(55,100); itemEnt.SetHealth("","",rndHlt); } } //This func can be used or not, it is your choice // Эта функция может использоваться или нет, это ваш выбор void addMags(PlayerBase player, string mag_type, int count) { EntityAI mag; if (count < 1) return; for (int i = 0; i < count; i++) { mag = player.GetInventory().CreateInInventory(mag_type); } } 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; } override void StartingEquipSetup(PlayerBase player, bool clothesChosen) { /* player.RemoveAllItems(); EntityAI item = player.GetInventory().CreateInInventory(topsMissionArray.GetRandomElement()); EntityAI item2 = player.GetInventory().CreateInInventory(pantsArray.GetRandomElement()); EntityAI item3 = player.GetInventory().CreateInInventory(shoesArray.GetRandomElement()); */ //Entitys //Объект EntityAI itemEnt; EntityAI gun_m4a1; EntityAI gun_fnx45; EntityAI cloth_gorkaHelmet; EntityAI cloth_militaryBoots; //Put your admin uids here const string admin_uid0 = "xxxxxxxxxxxxxxx"; const string admin_uid1 = "xxxxxxxxxxxxxxx"; const string admin_uid2 = "xxxxxxxxxxxxxxx"; const string admin_uid3 = "xxxxxxxxxxxxxxx"; const string admin_uid4 = "xxxxxxxxxxxxxxx"; const string admin_uid5 = "xxxxxxxxxxxxxxx"; //Get player uid string player_uid = player.GetIdentity().GetPlainId(); //Check if admin or not and choose spawn type //Проверяет, если администратор или нет и выберает тип появления if(player_uid == admin_uid0 || player_uid == admin_uid1 || player_uid == admin_uid2 || player_uid == admin_uid3 || player_uid == admin_uid4 || player_uid == admin_uid5) { // =================================== ADMIN SPAWN & DONATOR ========================================== // //Remove All Items //Удалить все элементы player.RemoveAllItems(); //Backpack //Рюкзак ItemBase.Cast(player.GetInventory().CreateInInventory("HuntingBag")); //Clothing //Одежда cloth_gorkaHelmet = player.GetInventory().CreateInInventory("GorkaHelmet"); //cloth_gorkaHelmet.GetInventory().CreateAttachment("GorkaHelmetVisor"); //not working, don't know why // не работает, не знаю почему cloth_militaryBoots = player.GetInventory().CreateInInventory("MilitaryBoots_Black"); cloth_militaryBoots.GetInventory().CreateAttachment("CombatKnife"); //attach the knife to the boots // прикрепить нож к сапогам ItemBase.Cast(player.GetInventory().CreateInInventory("BalaclavaMask_Blackskull")); ItemBase.Cast(player.GetInventory().CreateInInventory("TacticalGloves_Black")); ItemBase.Cast(player.GetInventory().CreateInInventory("TTsKOJacket_Camo")); ItemBase.Cast(player.GetInventory().CreateInInventory("TTSKOPants")); ItemBase.Cast(player.GetInventory().CreateInInventory("Armband_White")); //Primary Weapon //Основное оружие gun_m4a1 = player.GetHumanInventory().CreateInHands("M4A1"); //if not working you can try .GetEntityInHands() // если не работает, вы можете попробовать .GetEntityInHands () //attach the following attachments to the gun // прикрепляем следующие насадки к оружию gun_m4a1.GetInventory().CreateAttachment("ACOGOptic"); gun_m4a1.GetInventory().CreateAttachment("M4_Suppressor"); gun_m4a1.GetInventory().CreateAttachment("M4_RISHndgrd_Black"); gun_m4a1.GetInventory().CreateAttachment("M4_OEBttstck_Black"); gun_m4a1.GetInventory().CreateAttachment("Light_Universal"); //gun_m4a1.GetInventory().CreateAttachment("Mag_STANAG_30Rnd"); BUGGY DONT USE //БАГГИ НЕ ИСПОЛЬЗУЙТЕ //addMags(player, "Mag_STANAG_30Rnd", 2); //addMags(player, "Mag_STANAGCoupled_30Rnd", 2); // Secondary Weapon // Вторичное оружие gun_fnx45 = player.GetInventory().CreateInInventory("FNX45"); gun_fnx45.GetInventory().CreateAttachment("PistolSuppressor"); //gun_fnx45.GetInventory().CreateAttachment("Mag_FNX45_15Rnd"); BUGGY DONT USE //БАГГИ НЕ ИСПОЛЬЗУЙТЕ //Ammunition ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_STANAG_30Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_STANAG_30Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_STANAG_30Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd")); //Food ItemBase.Cast(player.GetInventory().CreateInInventory("WaterBottle")); ItemBase.Cast(player.GetInventory().CreateInInventory("SodaCan_Kvass")); ItemBase.Cast(player.GetInventory().CreateInInventory("SodaCan_Kvass")); ItemBase.Cast(player.GetInventory().CreateInInventory("TunaCan")); ItemBase.Cast(player.GetInventory().CreateInInventory("TunaCan")); ItemBase.Cast(player.GetInventory().CreateInInventory("SardinesCan")); // Medical Supplies ItemBase.Cast(player.GetInventory().CreateInInventory("Morphine")); ItemBase.Cast(player.GetInventory().CreateInInventory("Rag")).SetQuantity(6); ItemBase.Cast(player.GetInventory().CreateInInventory("TetracyclineAntibiotics")); // Utilities ItemBase.Cast(player.GetInventory().CreateInInventory("Chemlight_Green")); ItemBase.Cast(player.GetInventory().CreateInInventory("Flashlight")); ItemBase.Cast(player.GetInventory().CreateInInventory("Battery9V")); ItemBase.Cast(player.GetInventory().CreateInInventory("SparkPlug")); //CreateQuickbar Shortcuts, 0 is the 1st place, 1 the 2nd etc. player.SetQuickBarEntityShortcut(gun_m4a1, 0, true); //you can use without true, true is for forcing player.SetQuickBarEntityShortcut(gun_m4a1, 0); // Можно использовать без true, true для принудительного проигрывания игрока. player.SetQuickBarEntityShortcut(gun_fnx45, 1, true); // =================================== ADMIN SPAWN & DONATOR ========================================== // } else{ // ============================= 1.0 Release Standard Loot for Players ================================ // //Remove All Items //Удалить все элементы player.RemoveAllItems(); float rand; itemEnt = ItemBase.Cast(player.GetInventory().CreateInInventory("Rag")).SetQuantity(6); SetRandomHealth(itemEnt); itemEnt = ItemBase.Cast(player.GetInventory().CreateInInventory("RoadFlare")); SetRandomHealth(itemEnt); rand = Math.RandomFloatInclusive(0.0, 1.0); if ( rand < 0.25 ) itemEnt = player.GetInventory().CreateInInventory("SodaCan_Cola"); else if ( rand > 0.75 ) itemEnt = player.GetInventory().CreateInInventory("SodaCan_Spite"); else itemEnt = player.GetInventory().CreateInInventory("SodaCan_Pipsi"); SetRandomHealth(itemEnt); rand = Math.RandomFloatInclusive(0.0, 1.0); if ( rand < 0.35 ) itemEnt = player.GetInventory().CreateInInventory("Apple"); else if ( rand > 0.65 ) itemEnt = player.GetInventory().CreateInInventory("Pear"); else itemEnt = player.GetInventory().CreateInInventory("Plum"); SetRandomHealth(itemEnt); // ============================= 1.0 Release Standard Loot for Players ================================ // } } }; Mission CreateCustomMission(string path) { return new CustomMission(); }
Beim Starten des Servers sind verschiedene Fehler fehlgeschlagen. Es wurde ein Fehler in der Zeile behoben, der jedoch weiter erschien und sich auf die Zeile bezieht, in der er geschrieben wurde
(float rand;)
Ich entschied mich für das Skript, ohne einen Block mit zufälliger Beute für Spieler. Und ich habe es durch permanente Beute ersetzt, aber aus irgendeinem Grund fällt eine Sportjacke "TrackSuitJacket_LightBlue" und Hose "TrackSuitPants_Black" (Sie sind für alle Spieler geschrieben) in den Steckplatz des Rucksacks, wenn Sie als Administrator hineingehen.
Es gibt ein Problem: Nachdem Sie der Hand ein Pipe-Zeichen hinzugefügt haben // gun_Pipe = player.GetHumanInventory().CreateInHands("Pipe"); //(für alle Spieler außer admin) , erscheinen keine (für normale Spieler) "Rag" und "Bandagen" im Inventar
Ich verstehe nicht, warum das so ist. Irgendwelche Ideen?
Dennoch gibt es Vorschläge, wie die Spawn-Koordinaten für Administratoren getrennt von den Spielern festgelegt werden können, damit sie nicht an der Küste erscheinen, beispielsweise in der Mitte der Karte.
Das Skript ist unten beigefügt.
Code
Alles anzeigenclass CustomMission: MissionServer { void SetRandomHealth(EntityAI itemEnt) { if ( itemEnt ) { int rndHlt = Math.RandomInt(55,100); itemEnt.SetHealth("","",rndHlt); } } //This func can be used or not, it is your choice // Эта функция может использоваться или нет, это ваш выбор void addMags(PlayerBase player, string mag_type, int count) { EntityAI mag; if (count < 1) return; for (int i = 0; i < count; i++) { mag = player.GetInventory().CreateInInventory(mag_type); } } 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; } override void StartingEquipSetup(PlayerBase player, bool clothesChosen) { /* player.RemoveAllItems(); EntityAI item = player.GetInventory().CreateInInventory(topsMissionArray.GetRandomElement()); EntityAI item2 = player.GetInventory().CreateInInventory(pantsArray.GetRandomElement()); EntityAI item3 = player.GetInventory().CreateInInventory(shoesArray.GetRandomElement()); */ // =================================== ADMIN SPAWN & DONATOR ========================================== // //Entitys //Объект EntityAI itemEnt; ItemBase itemBs; EntityAI gun_m4a1; EntityAI gun_fnx45; EntityAI gun_Pipe; EntityAI cloth_gorkaHelmet; EntityAI cloth_militaryBoots; //Put your admin uids here const string uid0 = "xxxxxxxxxxxxxxx"; const string uid1 = "xxxxxxxxxxxxxxx"; const string uid2 = "xxxxxxxxxxxxxxx"; const string uid3 = "xxxxxxxxxxxxxxx"; const string uid4 = "xxxxxxxxxxxxxxx"; const string uid5 = "xxxxxxxxxxxxxxx"; //Get player uid string player_uid = player.GetIdentity().GetPlainId(); //Remove All Items //Удалить все элементы player.RemoveAllItems(); // if(player_uid == uidхххх) Check if admin or not and choose spawn type //Проверяет, если администратор или нет и выберает тип появления // =============================== uid0 =============================== // if(player_uid == uid0) { //Backpack //Рюкзак ItemBase.Cast(player.GetInventory().CreateInInventory("HuntingBag")); //Clothing //Одежда cloth_gorkaHelmet = player.GetInventory().CreateInInventory("GorkaHelmet"); //cloth_gorkaHelmet.GetInventory().CreateAttachment("GorkaHelmetVisor"); //not working, don't know why // не работает, не знаю почему cloth_militaryBoots = player.GetInventory().CreateInInventory("MilitaryBoots_Black"); cloth_militaryBoots.GetInventory().CreateAttachment("CombatKnife"); //attach the knife to the boots // прикрепить нож к сапогам ItemBase.Cast(player.GetInventory().CreateInInventory("BalaclavaMask_Blackskull")); ItemBase.Cast(player.GetInventory().CreateInInventory("TacticalGloves_Black")); ItemBase.Cast(player.GetInventory().CreateInInventory("TTsKOJacket_Camo")); ItemBase.Cast(player.GetInventory().CreateInInventory("TTSKOPants")); //Primary Weapon //Основное оружие gun_m4a1 = player.GetHumanInventory().CreateInHands("M4A1"); //if not working you can try .GetEntityInHands() // если не работает, вы можете попробовать .GetEntityInHands () //attach the following attachments to the gun // прикрепляем следующие насадки к оружию gun_m4a1.GetInventory().CreateAttachment("ACOGOptic"); gun_m4a1.GetInventory().CreateAttachment("M4_Suppressor"); gun_m4a1.GetInventory().CreateAttachment("M4_RISHndgrd_Black"); gun_m4a1.GetInventory().CreateAttachment("M4_OEBttstck_Black"); gun_m4a1.GetInventory().CreateAttachment("Light_Universal"); //gun_m4a1.GetInventory().CreateAttachment("Mag_STANAG_30Rnd"); BUGGY DONT USE //БАГГИ НЕ ИСПОЛЬЗУЙТЕ //addMags(player, "Mag_STANAG_30Rnd", 2); //addMags(player, "Mag_STANAGCoupled_30Rnd", 2); // Secondary Weapon // Вторичное оружие gun_fnx45 = player.GetInventory().CreateInInventory("FNX45"); gun_fnx45.GetInventory().CreateAttachment("PistolSuppressor"); //gun_fnx45.GetInventory().CreateAttachment("Mag_FNX45_15Rnd"); BUGGY DONT USE //БАГГИ НЕ ИСПОЛЬЗУЙТЕ //Ammunition ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_STANAG_30Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_STANAG_30Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_STANAG_30Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd")); //Food ItemBase.Cast(player.GetInventory().CreateInInventory("WaterBottle")); ItemBase.Cast(player.GetInventory().CreateInInventory("SodaCan_Kvass")); ItemBase.Cast(player.GetInventory().CreateInInventory("SodaCan_Kvass")); ItemBase.Cast(player.GetInventory().CreateInInventory("TunaCan")); ItemBase.Cast(player.GetInventory().CreateInInventory("TunaCan")); ItemBase.Cast(player.GetInventory().CreateInInventory("SardinesCan")); // Medical Supplies ItemBase.Cast(player.GetInventory().CreateInInventory("Morphine")); ItemBase.Cast(player.GetInventory().CreateInInventory("Rag")).SetQuantity(6); ItemBase.Cast(player.GetInventory().CreateInInventory("TetracyclineAntibiotics")); // Utilities ItemBase.Cast(player.GetInventory().CreateInInventory("Chemlight_Green")); ItemBase.Cast(player.GetInventory().CreateInInventory("Flashlight")); ItemBase.Cast(player.GetInventory().CreateInInventory("Battery9V")); ItemBase.Cast(player.GetInventory().CreateInInventory("SparkPlug")); //CreateQuickbar Shortcuts, 0 is the 1st place, 1 the 2nd etc. player.SetQuickBarEntityShortcut(gun_m4a1, 0, true); //you can use without true, true is for forcing player.SetQuickBarEntityShortcut(gun_m4a1, 0); // Можно использовать без true, true для принудительного проигрывания игрока. player.SetQuickBarEntityShortcut(gun_fnx45, 1, true); } // =============================== uid1 =============================== // if(player_uid == uid1) { ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCBeretJACK")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCBandanaATACSFGMask")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCPCU5ATACSFGComander")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCPantsATACSFG")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCGlovesATACSFG")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCBootsATACSFG")); cloth_militaryBoots.GetInventory().CreateAttachment("CombatKnife"); //attach the knife to the boots ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCTacVestATACSFGLogo")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCAliceBagATACSFG")); ItemBase.Cast(player.GetInventory().CreateInInventory("TacticalBaconCan")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCBankaBaikal")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCBankaJackSmithWhiskey")); ItemBase.Cast(player.GetInventory().CreateInInventory("FNX45")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Rag")).SetQuantity(6); //.SetQuantity(x) set the amount of rags } // =============================== uid2 =============================== // if(player_uid == uid2) { ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCBeretHarry")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCBandanaATACSFGMask")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCPCU5ATACSFGComander")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCPantsATACSFG")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCGlovesATACSFG")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCBootsATACSFG")); cloth_militaryBoots.GetInventory().CreateAttachment("CombatKnife"); //attach the knife to the boots ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCTacVestATACSFGLogo")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCAliceBagATACSFG")); ItemBase.Cast(player.GetInventory().CreateInInventory("TacticalBaconCan")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCBankaBaikal")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCBankaJackSmithWhiskey")); ItemBase.Cast(player.GetInventory().CreateInInventory("FNX45")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Rag")).SetQuantity(6); //.SetQuantity(x) set the amount of rags } // ================================== uid3 =============================== // if(player_uid == uid3) { ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCBeretPRAPOR")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCBandanaATACSFGMask")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCPCU5ATACSFGComander")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCPantsATACSFG")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCGlovesATACSFG")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCBootsATACSFG")); cloth_militaryBoots.GetInventory().CreateAttachment("CombatKnife"); //attach the knife to the boots ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCTacVestATACSFGLogo")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCAliceBagATACSFG")); ItemBase.Cast(player.GetInventory().CreateInInventory("TacticalBaconCan")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCBankaBaikal")); ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCBankaJackSmithWhiskey")); ItemBase.Cast(player.GetInventory().CreateInInventory("FNX45")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Rag")).SetQuantity(6); //.SetQuantity(x) set the amount of rags } // ================================== uid4 =============================== // if(player_uid == uid4) {} // ================================== uid5 =============================== // if(player_uid == uid5) {} else { //DEFAULT LOOT //Give universal gear in inventory // Добавляет в руки оружие gun_Pipe = player.GetHumanInventory().CreateInHands("Pipe"); ItemBase.Cast(player.GetInventory().CreateInInventory("TrackSuitJacket_LightBlue")); ItemBase.Cast(player.GetInventory().CreateInInventory("TrackSuitPants_Black")); ItemBase.Cast(player.GetInventory().CreateInInventory("Sneakers_Black")); ItemBase.Cast(player.GetInventory().CreateInInventory("Rag")).SetQuantity(6); ItemBase.Cast(player.GetInventory().CreateInInventory("RoadFlare")); ItemBase.Cast(player.GetInventory().CreateInInventory("SodaCan_Kvass")); player.SetQuickBarEntityShortcut(gun_Pipe, 0, true); } } }; Mission CreateCustomMission(string path) { return new CustomMission(); }
-
Der Fehler war in Zeile 47, die Klamotten wurden immer entfernt.
Zudem sollte es jetzt auch mit 6 Admins laufen, nicht schön programmiert, aber hab gerade nicht viel Zeit.
Wenn man die Anzahl der Admins universell haben möchte schreibe ich am Wochenende noch schnell eine Schleife die das regelt. (in C leider nicht so easy wie in anderen Programmiersprachen)
C: init.c
Alles anzeigenclass CustomMission: MissionServer { void SetRandomHealth(EntityAI itemEnt) { if ( itemEnt ) { int rndHlt = Math.RandomInt(55,100); itemEnt.SetHealth("","",rndHlt); } } //This func can be used or not, it is your choice // Эта функция может использоваться или нет, это ваш выбор void addMags(PlayerBase player, string mag_type, int count) { EntityAI mag; if (count < 1) return; for (int i = 0; i < count; i++) { mag = player.GetInventory().CreateInInventory(mag_type); } } 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; } override void StartingEquipSetup(PlayerBase player, bool clothesChosen) { /* player.RemoveAllItems(); EntityAI item = player.GetInventory().CreateInInventory(topsMissionArray.GetRandomElement()); EntityAI item2 = player.GetInventory().CreateInInventory(pantsArray.GetRandomElement()); EntityAI item3 = player.GetInventory().CreateInInventory(shoesArray.GetRandomElement()); */ //Entitys //Объект EntityAI itemEnt; EntityAI gun_m4a1; EntityAI gun_fnx45; EntityAI cloth_gorkaHelmet; EntityAI cloth_militaryBoots; //Put your admin uids here const string admin_uid0 = "xxxxxxxxxxxxxxx"; const string admin_uid1 = "xxxxxxxxxxxxxxx"; const string admin_uid2 = "xxxxxxxxxxxxxxx"; const string admin_uid3 = "xxxxxxxxxxxxxxx"; const string admin_uid4 = "xxxxxxxxxxxxxxx"; const string admin_uid5 = "xxxxxxxxxxxxxxx"; //Get player uid string player_uid = player.GetIdentity().GetPlainId(); //Check if admin or not and choose spawn type //Проверяет, если администратор или нет и выберает тип появления if(player_uid == admin_uid0 || player_uid == admin_uid1 || player_uid == admin_uid2 || player_uid == admin_uid3 || player_uid == admin_uid4 || player_uid == admin_uid5) { // =================================== ADMIN SPAWN & DONATOR ========================================== // //Remove All Items //Удалить все элементы player.RemoveAllItems(); //Backpack //Рюкзак ItemBase.Cast(player.GetInventory().CreateInInventory("HuntingBag")); //Clothing //Одежда cloth_gorkaHelmet = player.GetInventory().CreateInInventory("GorkaHelmet"); //cloth_gorkaHelmet.GetInventory().CreateAttachment("GorkaHelmetVisor"); //not working, don't know why // не работает, не знаю почему cloth_militaryBoots = player.GetInventory().CreateInInventory("MilitaryBoots_Black"); cloth_militaryBoots.GetInventory().CreateAttachment("CombatKnife"); //attach the knife to the boots // прикрепить нож к сапогам ItemBase.Cast(player.GetInventory().CreateInInventory("BalaclavaMask_Blackskull")); ItemBase.Cast(player.GetInventory().CreateInInventory("TacticalGloves_Black")); ItemBase.Cast(player.GetInventory().CreateInInventory("TTsKOJacket_Camo")); ItemBase.Cast(player.GetInventory().CreateInInventory("TTSKOPants")); ItemBase.Cast(player.GetInventory().CreateInInventory("Armband_White")); //Primary Weapon //Основное оружие gun_m4a1 = player.GetHumanInventory().CreateInHands("M4A1"); //if not working you can try .GetEntityInHands() // если не работает, вы можете попробовать .GetEntityInHands () //attach the following attachments to the gun // прикрепляем следующие насадки к оружию gun_m4a1.GetInventory().CreateAttachment("ACOGOptic"); gun_m4a1.GetInventory().CreateAttachment("M4_Suppressor"); gun_m4a1.GetInventory().CreateAttachment("M4_RISHndgrd_Black"); gun_m4a1.GetInventory().CreateAttachment("M4_OEBttstck_Black"); gun_m4a1.GetInventory().CreateAttachment("Light_Universal"); //gun_m4a1.GetInventory().CreateAttachment("Mag_STANAG_30Rnd"); BUGGY DONT USE //БАГГИ НЕ ИСПОЛЬЗУЙТЕ //addMags(player, "Mag_STANAG_30Rnd", 2); //addMags(player, "Mag_STANAGCoupled_30Rnd", 2); // Secondary Weapon // Вторичное оружие gun_fnx45 = player.GetInventory().CreateInInventory("FNX45"); gun_fnx45.GetInventory().CreateAttachment("PistolSuppressor"); //gun_fnx45.GetInventory().CreateAttachment("Mag_FNX45_15Rnd"); BUGGY DONT USE //БАГГИ НЕ ИСПОЛЬЗУЙТЕ //Ammunition ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_STANAG_30Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_STANAG_30Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_STANAG_30Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd")); //Food ItemBase.Cast(player.GetInventory().CreateInInventory("WaterBottle")); ItemBase.Cast(player.GetInventory().CreateInInventory("SodaCan_Kvass")); ItemBase.Cast(player.GetInventory().CreateInInventory("SodaCan_Kvass")); ItemBase.Cast(player.GetInventory().CreateInInventory("TunaCan")); ItemBase.Cast(player.GetInventory().CreateInInventory("TunaCan")); ItemBase.Cast(player.GetInventory().CreateInInventory("SardinesCan")); // Medical Supplies ItemBase.Cast(player.GetInventory().CreateInInventory("Morphine")); ItemBase.Cast(player.GetInventory().CreateInInventory("Rag")).SetQuantity(6); ItemBase.Cast(player.GetInventory().CreateInInventory("TetracyclineAntibiotics")); // Utilities ItemBase.Cast(player.GetInventory().CreateInInventory("Chemlight_Green")); ItemBase.Cast(player.GetInventory().CreateInInventory("Flashlight")); ItemBase.Cast(player.GetInventory().CreateInInventory("Battery9V")); ItemBase.Cast(player.GetInventory().CreateInInventory("SparkPlug")); //CreateQuickbar Shortcuts, 0 is the 1st place, 1 the 2nd etc. player.SetQuickBarEntityShortcut(gun_m4a1, 0, true); //you can use without true, true is for forcing player.SetQuickBarEntityShortcut(gun_m4a1, 0); // Можно использовать без true, true для принудительного проигрывания игрока. player.SetQuickBarEntityShortcut(gun_fnx45, 1, true); // =================================== ADMIN SPAWN & DONATOR ========================================== // } else{ // ============================= 1.0 Release Standard Loot for Players ================================ // //Remove All Items //Удалить все элементы player.RemoveAllItems(); float rand; itemEnt = ItemBase.Cast(player.GetInventory().CreateInInventory("Rag")).SetQuantity(6); SetRandomHealth(itemEnt); itemEnt = ItemBase.Cast(player.GetInventory().CreateInInventory("RoadFlare")); SetRandomHealth(itemEnt); rand = Math.RandomFloatInclusive(0.0, 1.0); if ( rand < 0.25 ) itemEnt = player.GetInventory().CreateInInventory("SodaCan_Cola"); else if ( rand > 0.75 ) itemEnt = player.GetInventory().CreateInInventory("SodaCan_Spite"); else itemEnt = player.GetInventory().CreateInInventory("SodaCan_Pipsi"); SetRandomHealth(itemEnt); rand = Math.RandomFloatInclusive(0.0, 1.0); if ( rand < 0.35 ) itemEnt = player.GetInventory().CreateInInventory("Apple"); else if ( rand > 0.65 ) itemEnt = player.GetInventory().CreateInInventory("Pear"); else itemEnt = player.GetInventory().CreateInInventory("Plum"); SetRandomHealth(itemEnt); // ============================= 1.0 Release Standard Loot for Players ================================ // } } }; Mission CreateCustomMission(string path) { return new CustomMission(); }
Vielen Dank für Ihre Arbeit, ich weiß es zu schätzen! Heute werde ich testen
-
Es funktioniert für den Administrator, aber nicht für den normalen Spieler. Alles ist nackt mit Pepsi in der Hand.
-
imidazon this should work:
C: init.c
Alles anzeigenclass CustomMission: MissionServer { void SetRandomHealth(EntityAI itemEnt) { if ( itemEnt ) { int rndHlt = Math.RandomInt(55,100); itemEnt.SetHealth("","",rndHlt); } } //This func can be used or not, it is your choice // Эта функция может использоваться или нет, это ваш выбор void addMags(PlayerBase player, string mag_type, int count) { EntityAI mag; if (count < 1) return; for (int i = 0; i < count; i++) { mag = player.GetInventory().CreateInInventory(mag_type); } } 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; } override void StartingEquipSetup(PlayerBase player, bool clothesChosen) { /* player.RemoveAllItems(); EntityAI item = player.GetInventory().CreateInInventory(topsMissionArray.GetRandomElement()); EntityAI item2 = player.GetInventory().CreateInInventory(pantsArray.GetRandomElement()); EntityAI item3 = player.GetInventory().CreateInInventory(shoesArray.GetRandomElement()); */ //Remove All Items //Удалить все элементы player.RemoveAllItems(); // =================================== ADMIN SPAWN & DONATOR ========================================== // //Entitys //Объект EntityAI itemEnt; EntityAI itemTop; EntityAI gun_m4a1; EntityAI gun_fnx45; EntityAI cloth_gorkaHelmet; EntityAI cloth_militaryBoots; ItemBase itemBs; //Get & Save Admin UIDs //Получите и сохраните UID администратора const string admin_uid = "xxxxxxxxxxxxxxx"; const string admin_uid2 = "xxxxxxxxxxxxxxx"; string player_uid = player.GetIdentity().GetPlainId(); //Check if admin or not and choose spawn type //Проверяет, если администратор или нет и выберает тип появления if(player_uid == admin_uid || player_uid == admin_uid2) { // ADMIN SPAWN //Backpack //Рюкзак ItemBase.Cast(player.GetInventory().CreateInInventory("HuntingBag")); //Clothing //Одежда cloth_gorkaHelmet = player.GetInventory().CreateInInventory("GorkaHelmet"); //cloth_gorkaHelmet.GetInventory().CreateAttachment("GorkaHelmetVisor"); //not working, don't know why // не работает, не знаю почему cloth_militaryBoots = player.GetInventory().CreateInInventory("MilitaryBoots_Black"); cloth_militaryBoots.GetInventory().CreateAttachment("CombatKnife"); //attach the knife to the boots // прикрепить нож к сапогам ItemBase.Cast(player.GetInventory().CreateInInventory("BalaclavaMask_Blackskull")); ItemBase.Cast(player.GetInventory().CreateInInventory("TacticalGloves_Black")); ItemBase.Cast(player.GetInventory().CreateInInventory("TTsKOJacket_Camo")); ItemBase.Cast(player.GetInventory().CreateInInventory("TTSKOPants")); ItemBase.Cast(player.GetInventory().CreateInInventory("Armband_White")); //Primary Weapon //Основное оружие gun_m4a1 = player.GetHumanInventory().CreateInHands("M4A1"); //if not working you can try .GetEntityInHands() // если не работает, вы можете попробовать .GetEntityInHands () //attach the following attachments to the gun // прикрепляем следующие насадки к оружию gun_m4a1.GetInventory().CreateAttachment("ACOGOptic"); gun_m4a1.GetInventory().CreateAttachment("M4_Suppressor"); gun_m4a1.GetInventory().CreateAttachment("M4_RISHndgrd_Black"); gun_m4a1.GetInventory().CreateAttachment("M4_OEBttstck_Black"); gun_m4a1.GetInventory().CreateAttachment("Light_Universal"); //gun_m4a1.GetInventory().CreateAttachment("Mag_STANAG_30Rnd"); BUGGY DONT USE //БАГГИ НЕ ИСПОЛЬЗУЙТЕ //addMags(player, "Mag_STANAG_30Rnd", 2); //addMags(player, "Mag_STANAGCoupled_30Rnd", 2); // Secondary Weapon // Вторичное оружие gun_fnx45 = player.GetInventory().CreateInInventory("FNX45"); gun_fnx45.GetInventory().CreateAttachment("PistolSuppressor"); //gun_fnx45.GetInventory().CreateAttachment("Mag_FNX45_15Rnd"); BUGGY DONT USE //БАГГИ НЕ ИСПОЛЬЗУЙТЕ //Ammunition ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_STANAG_30Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_STANAG_30Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_STANAG_30Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd")); //Food ItemBase.Cast(player.GetInventory().CreateInInventory("WaterBottle")); ItemBase.Cast(player.GetInventory().CreateInInventory("SodaCan_Kvass")); ItemBase.Cast(player.GetInventory().CreateInInventory("SodaCan_Kvass")); ItemBase.Cast(player.GetInventory().CreateInInventory("TunaCan")); ItemBase.Cast(player.GetInventory().CreateInInventory("TunaCan")); ItemBase.Cast(player.GetInventory().CreateInInventory("SardinesCan")); // Medical Supplies ItemBase.Cast(player.GetInventory().CreateInInventory("Morphine")); ItemBase.Cast(player.GetInventory().CreateInInventory("Rag")).SetQuantity(6); ItemBase.Cast(player.GetInventory().CreateInInventory("TetracyclineAntibiotics")); // Utilities ItemBase.Cast(player.GetInventory().CreateInInventory("Chemlight_Green")); ItemBase.Cast(player.GetInventory().CreateInInventory("Flashlight")); ItemBase.Cast(player.GetInventory().CreateInInventory("Battery9V")); ItemBase.Cast(player.GetInventory().CreateInInventory("SparkPlug")); //CreateQuickbar Shortcuts, 0 is the 1st place, 1 the 2nd etc. player.SetQuickBarEntityShortcut(gun_m4a1, 0, true); //you can use without true, true is for forcing player.SetQuickBarEntityShortcut(gun_m4a1, 0); // Можно использовать без true, true для принудительного проигрывания игрока. player.SetQuickBarEntityShortcut(gun_fnx45, 1, true); // =================================== ADMIN SPAWN & DONATOR ========================================== // } else{ // ============================= 1.0 Release Standard Loot for Players ================================ // float rand; itemTop = player.FindAttachmentBySlotName("Body"); if (itemTop) { itemEnt = itemTop.GetInventory().CreateInInventory("Rag"); if (Class.CastTo(itemBs, itemEnt )) itemBs.SetQuantity(4); SetRandomHealth(itemEnt); itemEnt = itemTop.GetInventory().CreateInInventory("RoadFlare"); SetRandomHealth(itemEnt); } rand = Math.RandomFloatInclusive(0.0, 1.0); if ( rand < 0.25 ) itemEnt = player.GetInventory().CreateInInventory("SodaCan_Cola"); else if ( rand > 0.75 ) itemEnt = player.GetInventory().CreateInInventory("SodaCan_Spite"); else itemEnt = player.GetInventory().CreateInInventory("SodaCan_Pipsi"); SetRandomHealth(itemEnt); rand = Math.RandomFloatInclusive(0.0, 1.0); if ( rand < 0.35 ) itemEnt = player.GetInventory().CreateInInventory("Apple"); else if ( rand > 0.65 ) itemEnt = player.GetInventory().CreateInInventory("Pear"); else itemEnt = player.GetInventory().CreateInInventory("Plum"); SetRandomHealth(itemEnt); // ============================= 1.0 Release Standard Loot for Players ================================ // } } }; Mission CreateCustomMission(string path) { return new CustomMission(); }
Vielen Dank für Ihre Hilfe, jetzt werde ich testen! Eine andere Frage war, wie die Anzahl der Administratoren, beispielsweise 6 Personen, erhöht werden kann?
-
The first problem i found in the code is:
- cloth_militaryBoots is not defined, you want to access a variable that does not exist^^
- you should add this:
CodeEntityAI boots1; boots1 = ItemBase.Cast(player.GetInventory().CreateInInventory("MSFCBootsATACSFG")); boots1.GetInventory().CreateAttachment("CombatKnife");
and your code is structured so that there are 3 players who get this Loot, all others get none at all.
I can write a code which randomly choose one of these three presets, if you want
Guten Tag! Helfen Sie bitte, Ihre Dateien unter Version 1.0 anzupassen. Ich möchte sicherstellen, dass für alle Spieler die Standardeinstellungen der Beute standardmäßig festgelegt wurden (der Code wird niedriger sein) und für Administratoren waren Ihre Einstellungen vorhanden. Ich kann diese zwei Blöcke nicht kombinieren. Wenn Sie als normaler Spieler teilnehmen, ist er völlig nackt. Was mache ich falsch?
Code
Alles anzeigenclass CustomMission: MissionServer { void SetRandomHealth(EntityAI itemEnt) { if ( itemEnt ) { int rndHlt = Math.RandomInt(55,100); itemEnt.SetHealth("","",rndHlt); } } //This func can be used or not, it is your choice // Эта функция может использоваться или нет, это ваш выбор void addMags(PlayerBase player, string mag_type, int count) { EntityAI mag; if (count < 1) return; for (int i = 0; i < count; i++) { mag = player.GetInventory().CreateInInventory(mag_type); } } 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; } override void StartingEquipSetup(PlayerBase player, bool clothesChosen) { /* player.RemoveAllItems(); EntityAI item = player.GetInventory().CreateInInventory(topsMissionArray.GetRandomElement()); EntityAI item2 = player.GetInventory().CreateInInventory(pantsArray.GetRandomElement()); EntityAI item3 = player.GetInventory().CreateInInventory(shoesArray.GetRandomElement()); */ // ============================= 1.0 Release Standard Loot for Players ================================ // //Remove All Items //Удалить все элементы player.RemoveAllItems(); EntityAI itemEnt; ItemBase itemBs; EntityAI itemTop; float rand; itemTop = player.FindAttachmentBySlotName("Body"); if ( itemTop ) { itemEnt = itemTop.GetInventory().CreateInInventory("Rag"); if ( Class.CastTo(itemBs, itemEnt ) ) itemBs.SetQuantity(4); SetRandomHealth(itemEnt); itemEnt = itemTop.GetInventory().CreateInInventory("RoadFlare"); SetRandomHealth(itemEnt); } rand = Math.RandomFloatInclusive(0.0, 1.0); if ( rand < 0.25 ) itemEnt = player.GetInventory().CreateInInventory("SodaCan_Cola"); else if ( rand > 0.75 ) itemEnt = player.GetInventory().CreateInInventory("SodaCan_Spite"); else itemEnt = player.GetInventory().CreateInInventory("SodaCan_Pipsi"); SetRandomHealth(itemEnt); rand = Math.RandomFloatInclusive(0.0, 1.0); if ( rand < 0.35 ) itemEnt = player.GetInventory().CreateInInventory("Apple"); else if ( rand > 0.65 ) itemEnt = player.GetInventory().CreateInInventory("Pear"); else itemEnt = player.GetInventory().CreateInInventory("Plum"); SetRandomHealth(itemEnt); // ============================= 1.0 Release Standard Loot for Players ================================ // // =================================== ADMIN SPAWN & DONATOR ========================================== // //Entitys //Объект EntityAI gun_m4a1; EntityAI gun_fnx45; EntityAI cloth_gorkaHelmet; EntityAI cloth_militaryBoots; //Get & Save Admin UIDs //Получите и сохраните UID администратора const string admin_uid = "xxxxxxxxxxxxxxx"; const string admin_uid2 = "xxxxxxxxxxxxxxx"; string player_uid = player.GetIdentity().GetPlainId(); //Check if admin or not and choose spawn type //Проверяет, если администратор или нет и выберает тип появления if(player_uid == admin_uid || player_uid == admin_uid2) { // ADMIN SPAWN //Backpack //Рюкзак ItemBase.Cast(player.GetInventory().CreateInInventory("HuntingBag")); //Clothing //Одежда cloth_gorkaHelmet = player.GetInventory().CreateInInventory("GorkaHelmet"); //cloth_gorkaHelmet.GetInventory().CreateAttachment("GorkaHelmetVisor"); //not working, don't know why // не работает, не знаю почему cloth_militaryBoots = player.GetInventory().CreateInInventory("MilitaryBoots_Black"); cloth_militaryBoots.GetInventory().CreateAttachment("CombatKnife"); //attach the knife to the boots // прикрепить нож к сапогам ItemBase.Cast(player.GetInventory().CreateInInventory("BalaclavaMask_Blackskull")); ItemBase.Cast(player.GetInventory().CreateInInventory("TacticalGloves_Black")); ItemBase.Cast(player.GetInventory().CreateInInventory("TTsKOJacket_Camo")); ItemBase.Cast(player.GetInventory().CreateInInventory("TTSKOPants")); ItemBase.Cast(player.GetInventory().CreateInInventory("Armband_White")); //Primary Weapon //Основное оружие gun_m4a1 = player.GetHumanInventory().CreateInHands("M4A1"); //if not working you can try .GetEntityInHands() // если не работает, вы можете попробовать .GetEntityInHands () //attach the following attachments to the gun // прикрепляем следующие насадки к оружию gun_m4a1.GetInventory().CreateAttachment("ACOGOptic"); gun_m4a1.GetInventory().CreateAttachment("M4_Suppressor"); gun_m4a1.GetInventory().CreateAttachment("M4_RISHndgrd_Black"); gun_m4a1.GetInventory().CreateAttachment("M4_OEBttstck_Black"); gun_m4a1.GetInventory().CreateAttachment("Light_Universal"); //gun_m4a1.GetInventory().CreateAttachment("Mag_STANAG_30Rnd"); BUGGY DONT USE //БАГГИ НЕ ИСПОЛЬЗУЙТЕ //addMags(player, "Mag_STANAG_30Rnd", 2); //addMags(player, "Mag_STANAGCoupled_30Rnd", 2); // Secondary Weapon // Вторичное оружие gun_fnx45 = player.GetInventory().CreateInInventory("FNX45"); gun_fnx45.GetInventory().CreateAttachment("PistolSuppressor"); //gun_fnx45.GetInventory().CreateAttachment("Mag_FNX45_15Rnd"); BUGGY DONT USE //БАГГИ НЕ ИСПОЛЬЗУЙТЕ //Ammunition ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_STANAG_30Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_STANAG_30Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_STANAG_30Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd")); ItemBase.Cast(player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd")); //Food ItemBase.Cast(player.GetInventory().CreateInInventory("WaterBottle")); ItemBase.Cast(player.GetInventory().CreateInInventory("SodaCan_Kvass")); ItemBase.Cast(player.GetInventory().CreateInInventory("SodaCan_Kvass")); ItemBase.Cast(player.GetInventory().CreateInInventory("TunaCan")); ItemBase.Cast(player.GetInventory().CreateInInventory("TunaCan")); ItemBase.Cast(player.GetInventory().CreateInInventory("SardinesCan")); // Medical Supplies ItemBase.Cast(player.GetInventory().CreateInInventory("Morphine")); ItemBase.Cast(player.GetInventory().CreateInInventory("Rag")).SetQuantity(6); ItemBase.Cast(player.GetInventory().CreateInInventory("TetracyclineAntibiotics")); // Utilities ItemBase.Cast(player.GetInventory().CreateInInventory("Chemlight_Green")); ItemBase.Cast(player.GetInventory().CreateInInventory("Flashlight")); ItemBase.Cast(player.GetInventory().CreateInInventory("Battery9V")); ItemBase.Cast(player.GetInventory().CreateInInventory("SparkPlug")); //CreateQuickbar Shortcuts, 0 is the 1st place, 1 the 2nd etc. player.SetQuickBarEntityShortcut(gun_m4a1, 0, true); //you can use without true, true is for forcing player.SetQuickBarEntityShortcut(gun_m4a1, 0); // Можно использовать без true, true для принудительного проигрывания игрока. player.SetQuickBarEntityShortcut(gun_fnx45, 1, true); // =================================== ADMIN SPAWN & DONATOR ========================================== // } } }; Mission CreateCustomMission(string path) { return new CustomMission(); }