Raised This Month: $32 Target: $400
 8% 

[CS:GO] Server crashes when terrorist dies


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zezad
New Member
Join Date: Sep 2022
Old 09-28-2022 , 08:33   [CS:GO] Server crashes when terrorist dies
Reply With Quote #1

I'm trying to make my own prophunt script but my server crashes when a prop dies.

dust_models is an 2d array with d2 models

PHP Code:
public void OnPluginStart()
{
    
HookEvent("round_start"Event_Round_Start);
    
HookEvent("round_freeze_end"Event_Freeze);
    
RegConsoleCmd("sm_roll"roll_model);
}

public 
Action Event_Round_Start(Event eventchar[] namebool dontBroadcast)
{
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && GetClientTeam(i) == 2// 2 T 3 CT
        
{
            
SetEntityModel(idust_models[gen_random_number()]);
            
ClientCommand(i"thirdperson");
        }
    }

zezad is offline
boink
Member
Join Date: May 2021
Location: Australia
Old 09-28-2022 , 19:40   Re: [CS:GO] Server crashes when terrorist dies
Reply With Quote #2

From experience, if you set a players model to an empty model, eg. SetEntityModel(i, ""), the server will crash when they die.

I had this issue for a loooonggg time before figuring out why, however I was only setting players' models to other player skins so it's possible you are not setting an invalid model and it might be an issue with the model itself?

I would assign dust_models[gen_random_number()] to a variable then check to make sure it's not empty before setting their model.
__________________
@.boink. on Discord | DM for Plugin Requests | Tip Jar
boink is offline
zezad
New Member
Join Date: Sep 2022
Old 09-29-2022 , 07:51   Re: [CS:GO] Server crashes when terrorist dies
Reply With Quote #3

Quote:
Originally Posted by boink View Post
From experience, if you set a players model to an empty model, eg. SetEntityModel(i, ""), the server will crash when they die.

I had this issue for a loooonggg time before figuring out why, however I was only setting players' models to other player skins so it's possible you are not setting an invalid model and it might be an issue with the model itself?

I would assign dust_models[gen_random_number()] to a variable then check to make sure it's not empty before setting their model.
So I did an if to see if string was empty (don't know if that's the way it is done) and also print to the clients chat the model that they are. It works fine every terrorist changes into a random prop but the issue remains, when any terrorist die the game crashes.

PHP Code:
public Action Event_Round_Start(Event eventchar[] namebool dontBroadcast)
{
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && GetClientTeam(i) == 2// 2 T 3 CT
        
{
            
char model[128];
            
model dust_models[gen_random_number()];
            
PrintToChat(i"%s"model);
            if (
model[0] != '\0')
            {
                
SetEntityModel(imodel);
                
ClientCommand(i"thirdperson");
            }
        }
    }

I also played an offline game with bots and changed into a banana following these steps:
PHP Code:
1. "sv_cheats 1"
2. Spawn a chicken or prop"give chicken"
Spawn a banana"prop_physics_create \props\cs_italy\bananna_bunch.mdl"
3. "clear" and "sv_precacheinfo"
4. Locate the modelindex number of the prop.
5. Transform yourselfent_fire !self addoutput "modelindex (number)" 
And when i died the game crashed aswell.
zezad is offline
Cruze
Veteran Member
Join Date: May 2017
Old 09-29-2022 , 09:52   Re: [CS:GO] Server crashes when terrorist dies
Reply With Quote #4

Are you precaching the models?
__________________
Taking paid private requests! Contact me
Cruze is offline
zezad
New Member
Join Date: Sep 2022
Old 09-29-2022 , 10:06   Re: [CS:GO] Server crashes when terrorist dies
Reply With Quote #5

Quote:
Originally Posted by Cruze View Post
Are you precaching the models?
PHP Code:
public void OnMapStart()
{
    
load_dust_models();
}

void load_dust_models()
{
    
int i;
    for (
0sizeof(dust_models); i++)
    {
        if(
IsModelPrecached(dust_models[i]))
        {
            continue;
        }
        
PrecacheModel(dust_models[i]);
    }

zezad is offline
boink
Member
Join Date: May 2021
Location: Australia
Old 09-30-2022 , 03:20   Re: [CS:GO] Server crashes when terrorist dies
Reply With Quote #6

Rather than changing the model of the player, you could try spawning a prop_dynamic_override, and set that model to the prop, then parent it to the player and make the player invisible
__________________
@.boink. on Discord | DM for Plugin Requests | Tip Jar
boink 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 13:49.


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