Raised This Month: $12 Target: $400
 3% 

VSH2: Hidden Bosses


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sajt
Member
Join Date: Apr 2023
Old 10-25-2023 , 12:09   VSH2: Hidden Bosses
Reply With Quote #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);
}
}
Sajt is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:05.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode