AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   When I try to test the plugin, it crashes the game (https://forums.alliedmods.net/showthread.php?t=332642)

Itz 05-24-2021 19:49

When I try to test the plugin, it crashes the game
 
When I try to test the plugin I made some changes it crashes the game

PHP Code:

/*================================================================================
    
    ----------------------------------
    -*- [ZP] Game Mode: NightMare -*-
    ----------------------------------
    
    This plugin is part of Zombie Plague Mod and is distributed under the
    terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
    
================================================================================*/

#include <amxmodx>
#include <fun>
#include <amx_settings_api>
#include <cs_teams_api>
#include <zp50_gamemodes>
#include <zp50_class_nemesis>
#include <zp50_class_assassin>
#include <zp50_class_survivor>
#include <zp50_class_sniper>
#include <zp50_class_plasma>
#include <zp50_class_knifer>
#include <zp50_class_dragon>
#include <zp50_class_nightcrawler>
#include <zp50_deathmatch>

// Settings file
new const ZP_SETTINGS_FILE[] = "zombieplague.ini"

// Default sounds
new const sound_nightmare[][] = { "zombie_plague/nemesis1.wav" "zombie_plague/survivor1.wav" }

#define SOUND_MAX_LENGTH 64

new Array:g_sound_nightmare

// HUD messages
#define HUD_EVENT_X -1.0
#define HUD_EVENT_Y 0.17
#define HUD_EVENT_R 255
#define HUD_EVENT_G 50
#define HUD_EVENT_B 20

new g_MaxPlayers
new g_HudSync

new cvar_nightmare_chancecvar_nightmare_min_players
//new cvar_nightmare_ratio
new cvar_nightmare_nem_hp_multicvar_nightmare_surv_hp_multicvar_nightmare_sniper_hp_multicvar_nightmare_kni_hp_multicvar_nightmare_plasm_hp_multicvar_nightmare_drag_hp_multicvar_nightmare_nigh_hp_multi,
new 
cvar_nightmare_allow_respawn

public plugin_precache()
{
    
// Register game mode at precache (plugin gets paused after this)
    
register_plugin("[ZP] Game Mode: NightMare"ZP_VERSION_STRING"***Gho$t***")
    
zp_gamemodes_register("NightMare Mode")
    
    
// Create the HUD Sync Objects
    
g_HudSync CreateHudSyncObj()
    
    
g_MaxPlayers get_maxplayers()
    
    
cvar_nightmare_chance register_cvar("zp_nightmare_chance""30")
    
cvar_nightmare_min_players register_cvar("zp_nightmare_min_players""0")
    
cvar_nightmare_ratio register_cvar("zp_nightmare_ratio""0.5")
    
cvar_nightmare_nem_hp_multi register_cvar("zp_nightmare_nem_hp_multi""0.25")
    
cvar_nightmare_surv_hp_multi register_cvar("zp_nightmare_surv_hp_multi""0.25")
    
cvar_nightmare_sniper_hp_multi register_cvar("zp_nightmare_sniper_hp_multi""0.25")
    
cvar_nightmare_kni_hp_multi register_cvar("zp_nightmare_knife_hp_multi""0.25")
    
cvar_nightmare_drag_hp_multi register_cvar("zp_nightmare_dragon_hp_multi""1.0")
    
cvar_nightmare_plasm_hp_multi register_cvar("zp_nightmare_plasma_hp_multi""1.0")
    
cvar_nightmare_nigh_hp_multi register_cvar("zp_nightmare_nightcrawler_hp_multi""1.0")
    
cvar_nightmare_show_hud register_cvar("zp_nightmare_show_hud""1")
    
cvar_nightmare_sounds register_cvar("zp_nightmare_sounds""1")
    
cvar_nightmare_allow_respawn register_cvar("zp_nightmare_allow_respawn""0")
    
    
// Initialize arrays
    
g_sound_nightmare ArrayCreate(SOUND_MAX_LENGTH1)
    
    
// Load from external file
    
amx_load_setting_string_arr(ZP_SETTINGS_FILE"Sounds""ROUND NIGHTMARE"g_sound_nightmare)
    
    
// If we couldn't load custom sounds from file, use and save default ones
    
new index
    
if (ArraySize(g_sound_nightmare) == 0)
    {
        for (
index 0index sizeof sound_nightmareindex++)
            
ArrayPushString(g_sound_nightmaresound_nightmare[index])
        
        
// Save to external file
        
amx_save_setting_string_arr(ZP_SETTINGS_FILE"Sounds""ROUND NIGHTMARE"g_sound_nightmare)
    }
    
    
// Precache sounds
    
new sound[SOUND_MAX_LENGTH]
    for (
index 0index ArraySize(g_sound_nightmare); index++)
    {
        
ArrayGetString(g_sound_nightmareindexsoundcharsmax(sound))
        if (
equal(sound[strlen(sound)-4], ".mp3"))
        {
            
format(soundcharsmax(sound), "sound/%s"sound)
            
precache_generic(sound)
        }
        else
            
precache_sound(sound)
    } 
}

// Deathmatch module's player respawn forward
public zp_fw_deathmatch_respawn_pre(id)
{
    
// Respawning allowed?
    
if (!get_pcvar_num(cvar_nightmare_allow_respawn))
        return 
PLUGIN_HANDLED;
    
    return 
PLUGIN_CONTINUE;
}

public 
zp_fw_gamemodes_choose_pre(game_mode_idskipchecks)
{
    if (!
skipchecks)
    {
        
// Random chance
        
if (random_num(1get_pcvar_num(cvar_nightmare_chance)) != 1)
            return 
PLUGIN_HANDLED;
        
        
// Min players
        
if (GetAliveCount() < get_pcvar_num(cvar_nightmare_min_players))
            return 
PLUGIN_HANDLED;
    }
    
    
// Game mode allowed
    
return PLUGIN_CONTINUE;
}

public 
zp_fw_gamemodes_start()
{
    
// Calculate player counts
    
new idalive_count GetAliveCount()
    new 
survivor_count floatround(alive_count 0.20floatround_ceil)
    
//new nemesis_count = floatround(alive_count * 0.20, floatround_ceil)
    //new sniper_count = floatround(alive_count * 0.10, floatround_ceil)
    //new knife_count = floatround(alive_count * 0.15, floatround_ceil)
    //new plasma_count = floatround(alive_count * 0.10, floatround_ceil)
    //new dragon_count = floatround(alive_count * 0.15, floatround_ceil)
    //new nightcrawler_count = floatround(alive_count * 0.10, floatround_ceil)
    
new nemesis_count survivor_count
    
new sniper_count survivor_count
    
new knife_count survivor_count
    
new plasma_count survivor_count
    
new dragon_count survivor_count
    
new nightcrawler_count survivor_count
    
    
// Turn specified amount of players into Survivors
    
new iSurvivorsiMaxSurvivors survivor_count
    
while (iSurvivors iMaxSurvivors)
    {
        
// Choose random guy
        
id GetRandomAlive(random_num(1alive_count))
        
        
// Already a survivor?
        
if (zp_class_survivor_get(id))
            continue;
        
        
// If not, turn him into one
        
zp_class_survivor_set(id)
        
iSurvivors++
        
        
// Apply survivor health multiplier
        
set_user_health(idfloatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_surv_hp_multi)))
    }
    
    
// Turn specified amount of players into Nemesis
    
new iNemesisiMaxNemesis nemesis_count
    
while (iNemesis iMaxNemesis)
    {
        
// Choose random guy
        
id GetRandomAlive(random_num(1alive_count))
        
        
// Already a survivor or nemesis?
        
if (zp_class_survivor_get(id) || zp_class_nemesis_get(id))
            continue;
        
        
// If not, turn him into one
        
zp_class_nemesis_set(id)
        
iNemesis++
        
        
// Apply nemesis health multiplier
        
set_user_health(idfloatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_nem_hp_multi)))
    }
    
    
// Turn specified amount of players into Snipers
    
new iSnipersiMaxSnipers sniper_count
    
while (iSnipers iMaxSnipers)
    {
        
// Choose random guy
        
id GetRandomAlive(random_num(1alive_count))
        
        
// Already a survivor or nemesis?
        
if (zp_class_survivor_get(id) || zp_class_nemesis_get(id) || zp_class_sniper_get(id) || zp_class_knifer_get(id) || zp_class_plasma_get(id) || zp_class_dragon_get(id) || zp_class_nightcrawler_get(id))
            continue;
        
        
// If not, turn him into one
        
zp_class_sniper_set(id)
        
iSnipers++
        
        
// Apply sniper health multiplier
        
set_user_health(idfloatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_sniper_hp_multi)))
    }
    
    
// Turn specified amount of players into Knifer
    
new iKnifeiMaxKnife knife_count
    
while (iKnife iMaxKnife)
    {
        
// Choose random guy
        
id GetRandomAlive(random_num(1alive_count))
        
        
// Already a survivor or nemesis?
        
if (zp_class_survivor_get(id) || zp_class_nemesis_get(id) || zp_class_sniper_get(id) || zp_class_knifer_get(id) || zp_class_plasma_get(id) || zp_class_dragon_get(id) || zp_class_nightcrawler_get(id))
            continue;
        
        
// If not, turn him into one
        
zp_class_knifer_set(id)
        
iKnife++
        
        
// Apply Knife health multiplier
        
set_user_health(idfloatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_kni_hp_multi)))
    }
    
    
// Turn specified amount of players into Knifer
    
new iPlasmaiMaxPlasma plasma_count
    
while (iPlasma iMaxPlasma)
    {
        
// Choose random guy
        
id GetRandomAlive(random_num(1alive_count))
        
        
// Already a survivor or nemesis?
        
if (zp_class_survivor_get(id) || zp_class_nemesis_get(id) || zp_class_sniper_get(id) || zp_class_knifer_get(id) || zp_class_plasma_get(id) || zp_class_dragon_get(id) || zp_class_nightcrawler_get(id))
            continue;
        
        
// If not, turn him into one
        
zp_class_plasma_set(id)
        
iPlasma++
        
        
// Apply Plasma health multiplier
        
set_user_health(idfloatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_plasm_hp_multi)))
    }
    
    
// Turn specified amount of players into Knifer
    
new iDragoniMaxDragon dragon_count
    
while (iDragon iMaxDragon)
    {
        
// Choose random guy
        
id GetRandomAlive(random_num(1alive_count))
        
        
// Already a survivor or nemesis?
        
if (zp_class_survivor_get(id) || zp_class_nemesis_get(id) || zp_class_sniper_get(id) || zp_class_knifer_get(id) || zp_class_plasma_get(id) || zp_class_dragon_get(id) || zp_class_nightcrawler_get(id))
            continue;
        
        
// If not, turn him into one
        
zp_class_dragon_set(id)
        
iDragon++
        
        
// Apply Dragon health multiplier
        
set_user_health(idfloatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_drag_hp_multi)))
    }
    
    
// Turn specified amount of players into Knifer
    
new iNightCrawleriMaxNightCrawler nightcrawler_count
    
while (iNightCrawler iMaxNightCrawler)
    {
        
// Choose random guy
        
id GetRandomAlive(random_num(1alive_count))
        
        
// Already a survivor or nemesis?
        
if (zp_class_survivor_get(id) || zp_class_nemesis_get(id) || zp_class_sniper_get(id) || zp_class_knifer_get(id) || zp_class_plasma_get(id) || zp_class_dragon_get(id) || zp_class_nightcrawler_get(id))
            continue;
        
        
// If not, turn him into one
        
zp_class_nightcrawler_set(id)
        
iNightCrawler++
        
        
// Apply NightCrawler health multiplier
        
set_user_health(idfloatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_nigh_hp_multi)))
    }
    
    
// Play Armageddon sound
    
if (get_pcvar_num(cvar_nightmare_sounds))
    {
        new 
sound[SOUND_MAX_LENGTH]
        
ArrayGetString(g_sound_nightmarerandom_num(0ArraySize(g_sound_nightmare) - 1), soundcharsmax(sound))
        
PlaySoundToClients(sound)
    }
    
    if (
get_pcvar_num(cvar_nightmare_show_hud))
    {
        
// Show Armageddon HUD notice
        
set_hudmessage(HUD_EVENT_RHUD_EVENT_GHUD_EVENT_BHUD_EVENT_XHUD_EVENT_Y10.05.01.01.0, -1)
        
ShowSyncHudMsg(0g_HudSync"NightMare Mode"LANG_PLAYER"NOTICE_NIGHTMARE")
    }
}

// Plays a sound on clients
PlaySoundToClients(const sound[])
{
    if (
equal(sound[strlen(sound)-4], ".mp3"))
        
client_cmd(0"mp3 play ^"sound/%s^""sound)
    else
        
client_cmd(0"spk ^"%s^""sound)
}

// Get Alive Count -returns alive players number-
GetAliveCount()
{
    new 
iAliveid
    
    
for (id 1id <= g_MaxPlayersid++)
    {
        if (
is_user_alive(id))
            
iAlive++
    }
    
    return 
iAlive;
}

// Get Random Alive -returns index of alive player number target_index -
GetRandomAlive(target_index)
{
    new 
iAliveid
    
    
for (id 1id <= g_MaxPlayersid++)
    {
        if (
is_user_alive(id))
            
iAlive++
        
        if (
iAlive == target_index)
            return 
id;
    }
    
    return -
1;



Bugsy 05-24-2021 20:43

Re: When I try to test the plugin, it crashes the game
 
Why don't you tell us what you changed so we do not need to read every line trying to find the mistake?

Itz 05-24-2021 23:25

Re: When I try to test the plugin, it crashes the game
 
Quote:

Originally Posted by Bugsy (Post 2747730)
Why don't you tell us what you changed so we do not need to read every line trying to find the mistake?

I made the following changes add new class

PHP Code:

#include <zp50_class_plasma>
#include <zp50_class_knifer>
#include <zp50_class_dragon>
#include <zp50_class_nightcrawler> 

add novos cvar

PHP Code:

cvar_nightmare_kni_hp_multi register_cvar("zp_nightmare_knife_hp_multi""0.25")
cvar_nightmare_drag_hp_multi register_cvar("zp_nightmare_dragon_hp_multi""1.0")
cvar_nightmare_plasm_hp_multi register_cvar("zp_nightmare_plasma_hp_multi""1.0")
cvar_nightmare_nigh_hp_multi register_cvar("zp_nightmare_nightcrawler_hp_multi""1.0"

add them here too

PHP Code:

public zp_fw_gamemodes_start()
{
    
// Calculate player counts
    
new idalive_count GetAliveCount()
    new 
survivor_count floatround(alive_count 0.20floatround_ceil)
    
//new nemesis_count = floatround(alive_count * 0.20, floatround_ceil)
    //new sniper_count = floatround(alive_count * 0.10, floatround_ceil)
    //new knife_count = floatround(alive_count * 0.15, floatround_ceil)
    //new plasma_count = floatround(alive_count * 0.10, floatround_ceil)
    //new dragon_count = floatround(alive_count * 0.15, floatround_ceil)
    //new nightcrawler_count = floatround(alive_count * 0.10, floatround_ceil)
    
new nemesis_count survivor_count
    
new sniper_count survivor_count
    
new knife_count survivor_count
    
new plasma_count survivor_count
    
new dragon_count survivor_count
    
new nightcrawler_count survivor_count 

And in that part

PHP Code:

// Turn specified amount of players into Knifer
    
new iKnifeiMaxKnife knife_count
    
while (iKnife iMaxKnife)
    {
        
// Choose random guy
        
id GetRandomAlive(random_num(1alive_count))
        
        
// Already a survivor or nemesis?
        
if (zp_class_survivor_get(id) || zp_class_nemesis_get(id) || zp_class_sniper_get(id) || zp_class_knifer_get(id) || zp_class_plasma_get(id) || zp_class_dragon_get(id) || zp_class_nightcrawler_get(id))
            continue;
        
        
// If not, turn him into one
        
zp_class_knifer_set(id)
        
iKnife++
        
        
// Apply Knife health multiplier
        
set_user_health(idfloatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_kni_hp_multi)))
    }
    
    
// Turn specified amount of players into Knifer
    
new iPlasmaiMaxPlasma plasma_count
    
while (iPlasma iMaxPlasma)
    {
        
// Choose random guy
        
id GetRandomAlive(random_num(1alive_count))
        
        
// Already a survivor or nemesis?
        
if (zp_class_survivor_get(id) || zp_class_nemesis_get(id) || zp_class_sniper_get(id) || zp_class_knifer_get(id) || zp_class_plasma_get(id) || zp_class_dragon_get(id) || zp_class_nightcrawler_get(id))
            continue;
        
        
// If not, turn him into one
        
zp_class_plasma_set(id)
        
iPlasma++
        
        
// Apply Plasma health multiplier
        
set_user_health(idfloatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_plasm_hp_multi)))
    }
    
    
// Turn specified amount of players into Knifer
    
new iDragoniMaxDragon dragon_count
    
while (iDragon iMaxDragon)
    {
        
// Choose random guy
        
id GetRandomAlive(random_num(1alive_count))
        
        
// Already a survivor or nemesis?
        
if (zp_class_survivor_get(id) || zp_class_nemesis_get(id) || zp_class_sniper_get(id) || zp_class_knifer_get(id) || zp_class_plasma_get(id) || zp_class_dragon_get(id) || zp_class_nightcrawler_get(id))
            continue;
        
        
// If not, turn him into one
        
zp_class_dragon_set(id)
        
iDragon++
        
        
// Apply Dragon health multiplier
        
set_user_health(idfloatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_drag_hp_multi)))
    }
    
    
// Turn specified amount of players into Knifer
    
new iNightCrawleriMaxNightCrawler nightcrawler_count
    
while (iNightCrawler iMaxNightCrawler)
    {
        
// Choose random guy
        
id GetRandomAlive(random_num(1alive_count))
        
        
// Already a survivor or nemesis?
        
if (zp_class_survivor_get(id) || zp_class_nemesis_get(id) || zp_class_sniper_get(id) || zp_class_knifer_get(id) || zp_class_plasma_get(id) || zp_class_dragon_get(id) || zp_class_nightcrawler_get(id))
            continue;
        
        
// If not, turn him into one
        
zp_class_nightcrawler_set(id)
        
iNightCrawler++
        
        
// Apply NightCrawler health multiplier
        
set_user_health(idfloatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_nigh_hp_multi)))
    }
    
    
// Play Armageddon sound
    
if (get_pcvar_num(cvar_nightmare_sounds))
    {
        new 
sound[SOUND_MAX_LENGTH]
        
ArrayGetString(g_sound_nightmarerandom_num(0ArraySize(g_sound_nightmare) - 1), soundcharsmax(sound))
        
PlaySoundToClients(sound)
    } 


fysiks 05-24-2021 23:52

Re: When I try to test the plugin, it crashes the game
 
One of the most important skills in programming is debugging. In this case, find out what code is executing when the plugin crashes the server. Comment out that code and see if it's still causing the crash. This will tell you what code is causing the issue.

However, there is a major issue in your code. All of your while loops are very likely causing infinite or near infinite loops. What you've implemented is a non-deterministic loop meaning that it's not guaranteed to execute in a predictable manner.

Also, using a random number based on the number of alive players as your "id" is wrong. To get a valid id of an alive player, you'd need to use something like get_players() and then index that array to get a valid id.

Itz 05-25-2021 07:37

Re: When I try to test the plugin, it crashes the game
 
Quote:

Originally Posted by fysiks (Post 2747741)
One of the most important skills in programming is debugging. In this case, find out what code is executing when the plugin crashes the server. Comment out that code and see if it's still causing the crash. This will tell you what code is causing the issue.

However, there is a major issue in your code. All of your while loops are very likely causing infinite or near infinite loops. What you've implemented is a non-deterministic loop meaning that it's not guaranteed to execute in a predictable manner.

Also, using a random number based on the number of alive players as your "id" is wrong. To get a valid id of an alive player, you'd need to use something like get_players() and then index that array to get a valid id.

I realized that the error is when I add a new class to the plugin

PHP Code:

#include <zp50_class_knifer> 

PHP Code:

 cvar_nightmare_kni_hp_multi
cvar_nightmare_kni_hp_multi 
register_cvar("zp_nightmare_knife_hp_multi""0.25"

I believe the error is in that part
PHP Code:

//new knife_count = floatround(alive_count * 0.25, floatround_ceil)
new knife_count survivor_count

// Turn specified amount of players into Knifer
    
new iKnifeiMaxKnife knife_count
    
while (iKnife iMaxKnife)
    {
        
// Choose random guy
        
id GetRandomAlive(random_num(1alive_count))
        
        
// Already a survivor or nemesis?
        
if (zp_class_survivor_get(id) || zp_class_nemesis_get(id) || zp_class_sniper_get(id) || zp_class_knifer_get(id))
            continue;
        
        
// If not, turn him into one
        
zp_class_knifer_set(id)
        
iKnife++
        
        
// Apply Knife health multiplier
        
set_user_health(idfloatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_kni_hp_multi)))
    } 

Without the class add the plugin works perfectly

fysiks 05-26-2021 00:27

Re: When I try to test the plugin, it crashes the game
 
Is it still crashing with that code in it? If yes, how does it crash, does the server just stop responding or does it actually crash with an error?

I would seriously suggest that you fix the two major issues I mentioned in my last post (for all of your while loops) and see if that fixes your problem.

Natsheh 05-26-2021 08:14

Re: When I try to test the plugin, it crashes the game
 
PHP Code:


    
while (iKnife iMaxKnife)
    {
        
// Choose random guy
        
id GetRandomAlive(random_num(1alive_count))
        
        
// Already a survivor or nemesis?
        
if (zp_class_survivor_get(id) || zp_class_nemesis_get(id) || zp_class_sniper_get(id) || zp_class_knifer_get(id))
            continue;
        
        
// If not, turn him into one
        
zp_class_knifer_set(id)
        
iKnife++
        
        
// Apply Knife health multiplier
        
set_user_health(idfloatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_kni_hp_multi)))
    } 

try to think abit about the logic of this loop and how it will end ?

Itz 05-27-2021 11:50

Re: When I try to test the plugin, it crashes the game
 
Quote:

Originally Posted by fysiks (Post 2747834)
Is it still crashing with that code in it? If yes, how does it crash, does the server just stop responding or does it actually crash with an error?

I would seriously suggest that you fix the two major issues I mentioned in my last post (for all of your while loops) and see if that fixes your problem.

It just makes the game stop responding after being executed

Itz 05-27-2021 11:56

Re: When I try to test the plugin, it crashes the game
 
Quote:

Originally Posted by Natsheh (Post 2747866)
PHP Code:


    
while (iKnife iMaxKnife)
    {
        
// Choose random guy
        
id GetRandomAlive(random_num(1alive_count))
        
        
// Already a survivor or nemesis?
        
if (zp_class_survivor_get(id) || zp_class_nemesis_get(id) || zp_class_sniper_get(id) || zp_class_knifer_get(id))
            continue;
        
        
// If not, turn him into one
        
zp_class_knifer_set(id)
        
iKnife++
        
        
// Apply Knife health multiplier
        
set_user_health(idfloatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_kni_hp_multi)))
    } 

try to think abit about the logic of this loop and how it will end ?

I did it following the way the plugin had already done like the others so I don't understand why the others that were already not crashing like the ones I add.

For example, this one that works without crashing

PHP Code:

    // Turn specified amount of players into Snipers
    
new iSnipersiMaxSnipers sniper_count
    
while (iSnipers iMaxSnipers)
    {
        
// Choose random guy
        
id GetRandomAlive(random_num(1alive_count))
        
        
// Already a survivor or nemesis?
        
if (zp_class_survivor_get(id) || zp_class_nemesis_get(id) || zp_class_sniper_get(id) )
            continue;
        
        
// If not, turn him into one
        
zp_class_sniper_set(id)
        
iSnipers++
        
        
// Apply sniper health multiplier
        
set_user_health(idfloatround(get_user_health(id) * get_pcvar_float(cvar_nightmare_sniper_hp_multi)))
    } 

But you may have to make these changes to make it work.

fysiks 05-27-2021 20:48

Re: When I try to test the plugin, it crashes the game
 
Even that one has a possibility of an infinite loop and should be fixed.


All times are GMT -4. The time now is 02:35.

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