View Single Post
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