Author
|
Message
|
Junior Member
|

10-25-2023
, 13:09
VSH2: Hidden Bosses
|
#1
|
Hi, can anyone help me?
My problem is that I'm trying to write a script that creates a Hidden Boss, the script doesn't write an error, but the script doesn't do anything
#include <sourcemod>
#include <vsh2>
#include <morecolors>
#include <sourcemod>
#include <sdktools>
#include <clientprefs>
#include <sdkhooks>
#include <morecolors>
public Plugin myinfo = {
name = "[VSH2] Hidden Bosses",
author = "[HUN]Mr.Sajt",
version = "1.0",
};
enum struct HiddenBosses {
float Chance;
// Itt adhatod meg a további beállításokat a főellenségek számára
}
HiddenBosses gentle_spy;
HiddenBosses painis_cupcake;
public void OnLibraryAdded(const char[] name) {
if( StrEqual(name, "VSH2") ) {
ConfigMap cfg = new ConfigMap("configs/chance.cfg"); // Fájl névét itt módosítottuk
if( cfg == null ) {
LogError("[VSH 2] ERROR :: **** couldn't find 'configs/chance.cfg'. Failed to load chance Config. ****");
return;
}
}
}
public void OnPluginStart() {
CreateConVar("vsh2_hidden_boss_chance", "10.0", "Chance for hidden boss to appear", FCVAR_REPLICATED);
}
public void OnMapStart()
{
new Float:chance = ReadChanceFromConfig()
LogMessage("Chance read from config: %f", chance);
if (GetRandomFloat(0.0, 100.0) <= chance)
{
if (GetRandomFloat(0.0, 100.0) <= gentle_spy.Chance)
{
CreateHiddenBossFromConfig("gentle_spy"); // Pass the boss name as an argument
}
else if (GetRandomFloat(0.0, 100.0) <= painis_cupcake.Chance)
{
CreateHiddenBossFromConfig("painis_cupcake"); // Pass the boss name as an argument
}
// További főellenségek ellenőrzése
}
}
public Float:ReadChanceFromConfig()
{
new Float:chance;
chance = GetConVarFloat(FindConVar("vsh2_hidden_boss_c hance"));
return chance;
}
public void CreateHiddenBossFromConfig(const char[] bossName)
{
new ent = CreateEntityByName(bossName); // Use the boss name passed as an argument
if (IsValidEntity(ent))
{
DispatchSpawn(ent);
EmitSoundToAll("sound/hiddenbosses/hiddenbosses.wav");
CPrintToChatAll("{olive}[VSH2] {green}Special Round: Hidden Boss has Appeared!");
}
else
{
LogError("Failed to create hidden boss entity with name: %s", bossName);
}
}
|
|
|
|