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

CS:S Update Broke my Plugin (Server Crashes)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NatalyaAF
Senior Member
Join Date: Dec 2008
Old 07-07-2010 , 22:45   CS:S Update Broke my Plugin (Server Crashes)
Reply With Quote #1

Whenever a player spawns with a certain of mine plugin loaded the server crashes. (This is only since the update.) Here's what that plugin does when a player spawns.


PHP Code:
public PlayerSpawnEvent(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (
GetConVarInt(g_Cvar_Enable))
    {
        new 
client GetClientOfUserId(GetEventInt(event"userid"));
         if (
IsPlayerAlive(client))
         {
            
SetEntityRenderColor(client255255255255);
            
IsCuffed[client] = false;
            
Warranted[client] = false;


            new 
String:plyr_class[32];
            new 
String:plyr_gender[16];
            new 
String:plyr_team[32];


            
GetPlayerClassTeam(clientplayerinfokvplyr_classplyr_team);


            
// Check how much money they have.  If they are new give them $500.
            
money[client] = KvGetNum(playerinfokv"Money"500);
            
KvGetString(playerinfokv"Gender"plyr_gendersizeof(plyr_gender), "Male");
            
team[client] = plyr_team;

            
PrintToChat(client"\x03[RP] You are a %s %s, and you have $ %i."plyr_genderplyr_classmoney[client]);
            
PrintToChat(client"\x03[RP] Your team is %s."plyr_team);

            if(
StrEqual(plyr_team"Government"false))
            {
                
CS_SwitchTeam(client3);
            } else 
CS_SwitchTeam(client2);

            
KvSetNum(playerinfokv"Money"money[client]);

            new 
MoneyOffset FindSendPropOffs("CCSPlayer""m_iAccount");
            
SetEntData(clientMoneyOffsetmoney[client], 4true);


            
// Figure out their class info (They have now been spawned and know thier stuff.)
            
KvJumpToKey(classmenukvplyr_teamfalse);
            
KvGotoFirstSubKey(classmenukvtrue);

            
// Why is it like this?  I have no idea.  Scroll through class menu and find player's class.
            
decl String:buffer[30];
            
KvGetSectionName(classmenukvbuffersizeof(buffer));
            new 
match = (strcmp(bufferplyr_classfalse));
            if (
match != 0)
            {
                do
                {
                    
KvGetSectionName(classmenukvbuffersizeof(buffer));
                    
match = (strcmp(bufferplyr_classfalse));

                } while ((
match != 0) && (KvGotoNextKey(classmenukv)));
             }
            
// Now choose model according to gender.  Assume male if not chosen.
            
new String:plyr_model[256];
            if (
strcmp(plyr_genderCMD_MALE) == 0)
            {
                
KvGetString(classmenukv"model_m"plyr_modelsizeof(plyr_model));
                if (!
StrEqual(plyr_model,""))
                {
                    if (
IsModelPrecached(plyr_model))
                    {
                        
SetEntityModel(clientplyr_model);
                    }
                    else if (!
IsModelPrecached(plyr_model))
                    {
                        
PrecacheModel(plyr_model);
                        
SetEntityModel(clientplyr_model);
                    }
                }
                else 
LogMessage("[RP Debug] Error in classes.ini for model_m of %s."plyr_class);
             }
            else if (
strcmp(plyr_genderCMD_FEMALE) == 0)
            {
                
KvGetString(classmenukv"model_f"plyr_modelsizeof(plyr_model));
                if (!
StrEqual(plyr_model,""))
                {
                    if (
IsModelPrecached(plyr_model))
                    {
                        
SetEntityModel(clientplyr_model);
                    }
                    else if (!
IsModelPrecached(plyr_model))
                    {
                        
PrecacheModel(plyr_model);
                        
SetEntityModel(clientplyr_model);
                    }
                }
                else 
LogMessage("[RP Debug] Error in classes.ini for model_f of %s."plyr_class);
             }

              
KvRewind(classmenukv);
            
KvRewind(playerinfokv);

            
// If custom spawns are enabled and there is a custom spawn config, teleport them to a spawn for their team.
            
if ((GetConVarInt(g_useSpawns)) && (g_useSpawns2 true))
            {
                
KvGotoFirstSubKey(classmenukvtrue);
                
decl String:buffer9[30];
                new 
= -1;
                new 
match2 = (strcmp(buffer9plyr_teamfalse));
                do
                {
                    
i++;
                    
KvGetSectionName(classmenukvbuffer9sizeof(buffer));
                    
match2 = (strcmp(buffer9plyr_teamfalse));

                } while ((
match2 != 0) && (KvGotoNextKey(classmenukv)));
                
KvRewind(classmenukv);

                new 
spawn_here = -1;

                do
                {
                    
spawn_here GetRandomInt(0g_SpawnQty);

                } while (
g_SpawnTeam[spawn_here] != i);

                
TeleportEntity(clientg_SpawnLoc[spawn_here], NULL_VECTORNULL_VECTOR);
            }

            new 
String:fuck[64];
            
GetClientName(clientfucksizeof(fuck));
            
ServerCommand("sm_disarm \"%s\""fuck);
            
GivePlayerItem(clientWPN_KNFE);
        }
    }

Does any of that look like it might make a server want to crash? Here's the crash error I get:

Code:
L 07/07/2010 - 21:17:38: "Ender(less)<2><STEAM_0:1:12522252><Unassigned>" joined team "TERRORIST"
PreMinidumpCallback: updating dump comment
Uploading dump (in-process) [proxy '']
/tmp/dumps/6e99f8b3-1c6c-10c8-0a3e980e-536516a8.dmp
./srcds_run: line 341: 27937 Segmentation fault      $HL_CMD
Also, where would I check to see what kind of changes need to be made to my plugins every time there's a big SM update so I don't have to come in here asking for help?
NatalyaAF is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 07-08-2010 , 10:40   Re: CS:S Update Broke my Plugin (Server Crashes)
Reply With Quote #2

If your using supercommands i hope you updated the offset for sm_disarm if not there is your crash. My server was crashing there i thought i had updated it and apperantly it changed in one of the small updates and kept crashing the server when used.

Last edited by Dr!fter; 07-08-2010 at 10:43.
Dr!fter is offline
NatalyaAF
Senior Member
Join Date: Dec 2008
Old 07-09-2010 , 19:31   Re: CS:S Update Broke my Plugin (Server Crashes)
Reply With Quote #3

Quote:
Originally Posted by YouzAMenace View Post
If your using supercommands i hope you updated the offset for sm_disarm if not there is your crash. My server was crashing there i thought i had updated it and apperantly it changed in one of the small updates and kept crashing the server when used.
How would I do that?
NatalyaAF 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 20:25.


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