AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Fatal Errors: SZ_GetSpace and MSG_ONE (https://forums.alliedmods.net/showthread.php?t=197190)

kramesa 09-29-2012 22:23

Fatal Errors: SZ_GetSpace and MSG_ONE
 
Hi mates.. I have an problem with my plugins.

I'm using the code bellow, but I have this error and the server crashes: SZ_GetSpace: overflow on dxTT FATAL ERROR (shutting down): MSG_ONE or MSG_ONE_UNRELIABLE with no target entity

Code:
stock kick_user(index, const szKickMsg[], any:...) {     new szMsg[128];     vformat(szMsg, sizeof(szMsg) - 1, szKickMsg, 3);         emessage_begin(MSG_ONE, SVC_DISCONNECT, _, index);     ewrite_string(szMsg);     emessage_end(); }

dias 09-30-2012 01:46

Re: Fatal Errors: SZ_GetSpace and MSG_ONE
 
PHP Code:

stock kick_user(index, const szKickMsg[], any:...) 
{
     if(!
is_user_connected(index))
          return

     new 
szMsg[128];     
     
format(szMsgsizeof(szMsg) - 1szKickMsg3)

     
emessage_begin(MSG_ONE_UNRELIABLESVC_DISCONNECT_index)
     
ewrite_string(szMsg);    
     
emessage_end(); 



kramesa 10-01-2012 12:22

Re: Fatal Errors: SZ_GetSpace and MSG_ONE
 
Quote:

Originally Posted by dias (Post 1809456)
PHP Code:

stock kick_user(index, const szKickMsg[], any:...) 
{
     if(!
is_user_connected(index))
          return

     new 
szMsg[128];     
     
format(szMsgsizeof(szMsg) - 1szKickMsg3)

     
emessage_begin(MSG_ONE_UNRELIABLESVC_DISCONNECT_index)
     
ewrite_string(szMsg);    
     
emessage_end(); 



Thanks man, I will test.

ConnorMcLeod 10-01-2012 13:50

Re: Fatal Errors: SZ_GetSpace and MSG_ONE
 
This doesn't kick players properly (this is only half of the kick process), use kick command.

PHP Code:

KickUser(idfmt[] = ""any:...)
{
    if( !
fmt[0] )
    {
        
server_cmd("kick #%d"get_user_userid(id))
    }
    else
    {
        static 
szReason[1024]
        
vformat(szReasoncharsmax(szReason), fmt3)
        
server_cmd("kick #%d ^"%s^""get_user_userid(id), szReason)
    }


More complete way if you still want to use that message would be :

PHP Code:

KickUser(idfmt[], any:...)
{
    if( !
is_user_connected(id) )
    {
        return
    }
    static 
szReason[1024], i
    i 
vformat(szReasoncharsmax(szReason), fmt3)
    if( 
== charsmax(szReason) )
    {
        
server_print("DropClient : A client drop message had to be truncated.")
    }

    static 
szName[32]
    
pev(idpev_netnameszNamecharsmax(szName))
    
server_print("Dropped %s, reason: %s"szNameszReason)

    
dllfunc(DLLFunc_ClientDisconnectid)

    
szReason[63] = EOS

    message_begin
(MSG_ONESVC_DISCONNECT, .player=id)
    
write_string(szReason)
    
message_end()


But i'm not sure it is complete, anyway, kick command is more efficient.

kramesa 10-01-2012 17:41

Re: Fatal Errors: SZ_GetSpace and MSG_ONE
 
Quote:

Originally Posted by dias (Post 1809456)
PHP Code:

stock kick_user(index, const szKickMsg[], any:...) 
{
     if(!
is_user_connected(index))
          return

     new 
szMsg[128];     
     
format(szMsgsizeof(szMsg) - 1szKickMsg3)

     
emessage_begin(MSG_ONE_UNRELIABLESVC_DISCONNECT_index)
     
ewrite_string(szMsg);    
     
emessage_end(); 



Crash with same error.

Quote:

Originally Posted by ConnorMcLeod (Post 1810599)
This doesn't kick players properly (this is only half of the kick process), use kick command.

PHP Code:

KickUser(idfmt[] = ""any:...)
{
    if( !
fmt[0] )
    {
        
server_cmd("kick #%d"get_user_userid(id))
    }
    else
    {
        static 
szReason[1024]
        
vformat(szReasoncharsmax(szReason), fmt3)
        
server_cmd("kick #%d ^"%s^""get_user_userid(id), szReason)
    }


More complete way if you still want to use that message would be :

PHP Code:

KickUser(idfmt[], any:...)
{
    if( !
is_user_connected(id) )
    {
        return
    }
    static 
szReason[1024], i
    i 
vformat(szReasoncharsmax(szReason), fmt3)
    if( 
== charsmax(szReason) )
    {
        
server_print("DropClient : A client drop message had to be truncated.")
    }

    static 
szName[32]
    
pev(idpev_netnameszNamecharsmax(szName))
    
server_print("Dropped %s, reason: %s"szNameszReason)

    
dllfunc(DLLFunc_ClientDisconnectid)

    
szReason[63] = EOS

    message_begin
(MSG_ONESVC_DISCONNECT, .player=id)
    
write_string(szReason)
    
message_end()


But i'm not sure it is complete, anyway, kick command is more efficient.

Thanks, I will try.


All times are GMT -4. The time now is 08:20.

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