Raised This Month: $ Target: $400
 0% 

Simple Command causing game crash...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dbozan99
Junior Member
Join Date: Jun 2008
Old 09-23-2008 , 23:11   Simple Command causing game crash...
Reply With Quote #1

After modifiing a working copy of one of my other scripts, My new script crashed everytime i got to the point where it did this:

Code:
new client = GetClientOfUserId(GetEventInt(event, "userid"));
After commenting this out, my game no longer crashed but, the code didn't do much of anything without it.

I was wondering why this was a problem because I didn't change it from my old script. It used to work just fine. Even compiling my old script used to work fine. now it does the exact same thing for the exact same line of code.

I have no idea what is going on here but, It's been making me very mad....

I've tried with sourcemod 1.0.3 and 1.0.4 and it doesn't seem to effect anything.

and, I've tried compiling with the compiler and the web compiler.

Please help.
Thx.
dbozan99 is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 09-23-2008 , 23:51   Re: Simple Command causing game crash...
Reply With Quote #2

Post the entire function that the code is in, and what kind of errors you are getting. That line alone is fine. It is hard to diagnose a problem with not much to go on, so get that stuff and should be easier to figure out.
__________________
CrimsonGT is offline
Kigen
BANNED
Join Date: Feb 2008
Old 09-24-2008 , 02:16   Re: Simple Command causing game crash...
Reply With Quote #3

It could be something that is using client.
Kigen is offline
Antithasys
Moderator
Join Date: Apr 2008
Old 09-24-2008 , 03:03   Re: Simple Command causing game crash...
Reply With Quote #4

Quote:
Originally Posted by Kigen View Post
It could be something that is using client.
Exactly. The reason is stopped working and didn't crash is because whatever you were trying to do with the client stopped working as well. The entire function is needed to determine the problem.
Antithasys is offline
dbozan99
Junior Member
Join Date: Jun 2008
Old 09-24-2008 , 18:30   Re: Simple Command causing game crash...
Reply With Quote #5

Well, I know what your thinking, but....my old, unmodified plugin used to compile and work just fine... Now, without any modifications. It wont work If I compile it.....

but, just to be sure.... heres the new code anyway.

Code:
public Action:Event_spawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (GetConVarBool(cvar_enable) == true)
    {
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    
    //Strip Weps
    SetEntData(client, g_iAccount, ZERO_MONEY);
    new wepIdx;
    for( new i = 0; i < 6; i++ ){
        while( ( wepIdx = GetPlayerWeaponSlot( client, i ) ) != -1 )
            {
            RemovePlayerItem( client, wepIdx );
            }
        }
    
    //Give Deagle
    GivePlayerItem(client, "item_assaultsuit");
    GivePlayerItem(client, "weapon_deagle");

    //Set Ammo
    SetEntData(client, g_iClip1, 0);
    SetEntData(client, g_iClip2, 1);
    }
}
dbozan99 is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 09-24-2008 , 18:59   Re: Simple Command causing game crash...
Reply With Quote #6

You're not indenting your stuff properly, and it could be causing problems with the new jit. Try doing this:

PHP Code:
public Action:Event_spawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (
GetConVarBool(cvar_enable) == true)
    {
        new 
client GetClientOfUserId(GetEventInt(event"userid"));
        
        
SetEntData(clientg_iAccountZERO_MONEY);

        
//Strip Weps
        
new wepIdx;
        for(new 
06i++)
        {
            while((
wepIdx GetPlayerWeaponSlot(clienti)) != -1)
            {
                
RemovePlayerItem(clientwepIdx);
            }
        }
        
        
//Give Deagle
        
GivePlayerItem(client"item_assaultsuit");
        
GivePlayerItem(client"weapon_deagle");

        
//Set Ammo
        
SetEntData(clientg_iClip10);
        
SetEntData(clientg_iClip21);
    }

bl4nk is offline
Sammy-ROCK!
Senior Member
Join Date: Jun 2008
Location: Near Mrs.Lag
Old 09-24-2008 , 21:56   Re: Simple Command causing game crash...
Reply With Quote #7

Does exactly the same thing except it'd take out some warnings from "loose indentation" which doesn't actualy interfer with plugin just alerts you that you could make a mismatch with unorganized code.
Sammy-ROCK! is offline
dbozan99
Junior Member
Join Date: Jun 2008
Old 09-25-2008 , 18:38   Re: Simple Command causing game crash...
Reply With Quote #8

I figured it out!

For some reason, EventScripts was interfering with SM and causing CSS to crash. It's never happened before, but I removed it and it works fine now!

Thanks for the help anyways.
dbozan99 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 05:20.


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