Raised This Month: $51 Target: $400
 12% 

Server crash problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 03-16-2011 , 10:24   Server crash problem
Reply With Quote #1

I didn't exactly write this disco code myself, I found it on the forum but I've made quite a few edits. Sometimes when it's called it works, but other times it crashes a few seconds into the disco or as soon as its activated. It does'nt leave an error log. I'm quite sure it works when I'm the only person in the server.
Here's what I have:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <engine>

#define write_coord_f(%0)  engfunc(EngFunc_WriteCoord,%0)

new const gDiscoClass[] = "disco"
new gDiscoSpritegDiscoEntgDiscoPlayer;

public 
plugin_precache()
{
    
gDiscoSprite precache_model("sprites/laserbeam.spr");
}

public 
plugin_init()
{
    
register_thinkgDiscoClass"thinkDisco" );

    
register_clcmd"say /start""cmdStart" );
}

public 
cmdStartid )
{
    
gDiscoPlayer id;

    new 
Float:Origin];
    
pevidpev_originOrigin )
    
    
gDiscoEnt create_entity"info_target" );
    
    
set_pev(gDiscoEnt,pev_classname,gDiscoClass)
        
    
engfunc(EngFunc_SetSize,gDiscoEnt,Float:{-311.0,-1.0,-1.0},Float:{311.0,1.0,1.0})
    
engfunc(EngFunc_SetOrigin,gDiscoEnt,Origin)
    
set_pev(gDiscoEnt,pev_effects,EF_BRIGHTFIELD)
    
set_pev(gDiscoEnt,pev_solid,SOLID_BBOX)
    
set_pev(gDiscoEnt,pev_movetype,MOVETYPE_TOSS)
    
set_pev(gDiscoEnt,pev_owner,id)
    
set_pev(gDiscoEnt,pev_nextthink,get_gametime()+0.1)

    
set_task20.0"DiscoEnd"id );
    
    return 
PLUGIN_HANDLED_MAIN;
}

public 
thinkDiscogDiscoEnt )
{
    if( !
is_valid_entgDiscoEnt ) )
    return 
PLUGIN_HANDLED;

    static 
Float:Origin];
    static 
Float:End];
    static 
Float:Position];
   
    
pevgDiscoPlayerpev_originOrigin );
    
    
End[0] = 1000.0
    End
[1] = 1000.0
    End
[2] = 1000.0
    
    trace_line
gDiscoPlayerOriginEnd,Position )
    
message_beginMSG_BROADCASTSVC_TEMPENTITY )
    
write_byte(TE_BEAMDISK)
    
    
write_coord_f(Origin[0])
    
write_coord_f(Origin[1])
    
write_coord_f(Origin[2])
    
write_coord_f(1000.0)
    
write_coord_f(1000.0)
    
write_coord_f(1000.0)
    
    
write_short(gDiscoSprite)
    
write_byte(0)
    
write_byte(0)
    
write_byte(1)
    
write_byte(5)
    
write_byte(50)
    
write_byte(random_num(1,255))
    
write_byte(random_num(1,255))
    
write_byte(random_num(1,255))
    
write_byte(200)
    
write_byte(30)
    
message_end()
    
    
set_pevgDiscoEntpev_nextthink,get_gametime() + 0.1 )
    
    return 
PLUGIN_CONTINUE;
}

public 
DiscoEndid )
{    
    
remove_entity_namegDiscoClass );
  
    return 
PLUGIN_CONTINUE;

Please don't worry about the efficiency in relation to an on/off variable and who can use it, that's simple, right now I just really want to get it working so it won't crash the server.

Thankyou!

Last edited by hornet; 03-16-2011 at 10:30.
hornet 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 03:34.


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