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

HH plugin problems.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 12-01-2016 , 11:55   HH plugin problems.
Reply With Quote #1

I'm working on a new plugin, when you kiill somebody a red heart entity will be respawned on that place, if somebody 'touch' the heart, the entity is removed and that guy take +1 lives, wich he can use that heart to respawn.

The problem itself is that when i Open my server the server is crashing, i have no idea why.
( Note: I have no errors in the log. )

PHP Code:
#include <amxmodx>
#include <fun>
#include <fakemeta>
#include <engine>
#include <nvault>
#include <hamsandwich>


new const PLUGIN[] = "Heart Lives";
new const 
VERSION[] = "1.0";
new const 
AUTHOR[] = "Craxor";


new const 
szHealthModel[] = "models/w_hh.mdl";
new const 
szTouchSound[] = "sound/flamethrower.wav";


new 
gHealthEntity[] = "health_heart_entitty";


new 
gLives[33], gAuthId[35][33],  gVault;
new const 
VName[] = "heart_respawn_vault";


public 
plugin_init( )
{
    
register_plugin
    
(
        
PLUGIN,
        
VERSION,
        
AUTHOR
    
);

    
register_event"DeathMsg","Event_DeathMsg","a" );
    
register_logevent"LOGEvent_Round_Start"2"1=Round_Start" );
    
    
register_forwardFM_Touch"forward_FM_Touch" );

    
gVault nvault_openVName )

    if( 
gVault == INVALID_HANDLE )
        
set_fail_state"Problems openning 'heart_respawn_vault' file." );


    
register_clcmd"say /respawn""respawn_hook" );
    
register_clcmd"say_team /respawn""respawn_hook" );

    
register_clcmd"say /lives""lives_hook" );
    
register_clcmd"say_team /lives""lives_hook" );
    
}

public 
lives_hookid 
{
    
client_printid print_chat"Lives to use: %i"gLives[id] );
    return 
PLUGIN_HANDLED;
}

public 
respawn_hookid )
{
    if( !
is_user_aliveid ) )
    {
        if( 
gLivesid ] > )
        {
            
ExecuteHamHam_CS_RoundRespawnid );
            
gLivesid ]--;
        }

        else
            
client_printid print_chat "You need at least one life to respawn!" );
    }

    else
        
client_printidprint_chat"You already are dead, use this command when you're dead!" );

    return 
PLUGIN_HANDLED;
}

public 
plugin_precache()
{
    
precache_modelszHealthModel );
    
precache_soundszTouchSound );

}
public 
Event_DeathMsg( )
{
    new 
iV read_data);

    static 
FLoat:flOrigin[3];
    
peviVpev_originflOrigin );

    new 
iEnt engfuncEngFunc_CreateNamedEntityengfuncEngFunc_AllocString"info_target" ) );


    
engfuncEngFunc_SetOriginiEntflOrigin );
    
        if( !
pev_validiEnt ) )
        {
        return 
PLUGIN_HANDLED;
        }
    
        
set_peviEntpev_classnamegHealthEntity );
        
engfuncEngFunc_SetModeliEntszHealthModel );
        
dllfuncDLLFunc_SpawniEnt );
        
set_peviEntpev_solidSOLID_BBOX );
        
set_peviEntpev_movetypeMOVETYPE_NONE );
        
engfuncEngFunc_SetSizeiEntFloat:{ -23.160000, -13.660000, -0.050000 }, Float:{ 11.47000012.7800006.720000 } );
        
engfuncEngFunc_DropToFlooriEnt );

    return 
PLUGIN_HANDLED;
}

public 
forward_FM_TouchiEntid )
{
    if( !
pev_validiEnt ) )
        return 
FMRES_IGNORED;
        
    
        new 
szClassname32 ];
        
peviEntpev_classnameszClassnamecharsmaxszClassname ) );
    
        if( !
equalszClassnamegHealthEntity) )
        {
        return 
FMRES_IGNORED;
        }
    
        
gLivesid ]++;
    
    
emit_soundidCHAN_ITEMszTouchSoundVOL_NORMATTN_NORMPITCH_NORM );

        
engfuncEngFunc_RemoveEntityiEnt );

        return 
FMRES_IGNORED;
}

public 
LOGEvent_Round_Start( )
{
    new 
iEntity = -1;

    while( ( 
iEntity find_ent_by_classiEntitygHealthEntity ) ) )
    {
        
engfuncEngFunc_RemoveEntityiEntity );
    }
        
}

public 
client_authorizedid )
{
    
// Anyways, bots have steamid as "BOT".

    
if( !is_user_botid ) )
    {
        
get_user_authididgAuthId[id], charsmaxgAuthId ) );

        new 
szData[11], iTs;

        if( 
nvault_lookupgVaultgAuthId[id], szDatacharsmaxszData ), iTs ) )
            
gLivesid ] = str_to_numszData );
    
    }
}
public 
client_disconnectid )
{
    new 
szData[11];
    
num_to_strgLives[id] , szData charsmaxszData ) );

    
nvault_setgVaultgAuthId[id], szData );
}

public 
plugin_end( ) nvault_closegVault 
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-01-2016 , 14:09   Re: HH plugin problems.
Reply With Quote #2

The server can't just crash without an error log or an pop-up window if it crashes instantly. Did you add the "w_hh.mdl" model? If yes, try deleting the nVault file. It doesn't crash on my server.
__________________

Last edited by OciXCrom; 12-01-2016 at 14:09.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 12-01-2016 , 14:24   Re: HH plugin problems.
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
The server can't just crash without an error log or an pop-up window if it crashes instantly. Did you add the "w_hh.mdl" model? If yes, try deleting the nVault file. It doesn't crash on my server.

Hahaha, that's because you do not use bots .. now i know the problem, thank you.

Is because i check in authorized if the index is not a bot, also in disconnect i do not check it, and it's saves an empty keys in vault file something like that:

" " "2"

Now i solve it, i add also the check if ( !is_user_bot .. inside of client_disconnect, thanks!
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
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:00.


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