Raised This Month: $ Target: $400
 0% 

Solved How to check that the buytime and finish


Post New Thread Reply   
 
Thread Tools Display Modes
GoRiLliAz
Senior Member
Join Date: May 2013
Old 05-31-2017 , 20:26   Re: How to check that the buytime and finish
Reply With Quote #11

Sorry for my english

In the plugins...

If a person can explain me in detail with a specific example in real conditions, I think I understand better.

I tried a lot of stuff but impossible to make it work it tells me every time
Quote:
//// resetscore_modified.sma
//
// C:\Users\GoRiLliAz2\Desktop\amxx git 5116\addons\amxmodx\scripting\resetscore
_modified.sma(3 : warning 203: symbol is never used: "HasBuytimeExpired"
// Header size: 932 bytes
// Code size: 6188 bytes
// Data size: 3156 bytes
// Stack/heap size: 16384 bytes
// Total requirements: 26660 bytes
//
// 1 Warning.
// Done.
//
// Compilation Time: 0,25 sec
on sourcemod i do them in 5 minutes, in amxmodx impossible !
__________________


Last edited by GoRiLliAz; 05-31-2017 at 21:30.
GoRiLliAz is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-01-2017 , 03:11   Re: How to check that the buytime and finish
Reply With Quote #12

The question is when you want to use it

If(HasBuytimeExpired()) if its true the buy time did expire.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
GoRiLliAz
Senior Member
Join Date: May 2013
Old 06-01-2017 , 04:18   Re: How to check that the buytime and finish
Reply With Quote #13

PHP Code:
/*
    Copyright © 2009, aNNakin
        Suport & help : http://forums.alliedmods.net/showthread.php?t=103669
    
    ResetScore is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ResetScore; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include < amxmodx >
#include < amxmisc >
#include < cstrike >
#include < fun >

#define PLUGIN "ResetScore"
#define VERSION "0.2.0"
#define AUTHOR "aNNakin"

new const gs_Commands[ ][ ] =
{
    
"say /rs",
    
"say_team /rs"
};

new 
ToggleMaxToggleIntervalToggleMoneyg_Pointer;
new 
gi_Reset33 ], gi_CanReset33 ];
 

public 
plugin_init ( )
{

    
register_plugin PLUGINVERSIONAUTHOR );
    
register_dictionary "resetscore.txt" );
    
    
register_concmd "amx_resetscore""resetscore_concmd"ADMIN_KICK"- <target>" );
    
    for ( new 
i_Indexi_Index sizeof gs_Commandsi_Index++ )
        
register_clcmd gs_Commandsi_Index ], "resetscore_clcmd" );
    
    
// how many times players can reset their score
    
ToggleMax register_cvar "resetscore_max""5" );
    
    
// how many minutes must pass before players can reset theirs score again
    
ToggleInterval register_cvar "resetscore_interval""3" );
    
    
// -2 don't set, -1 set at mp_startmoney value, another number will set to that value (e.g 0)
    
ToggleMoney register_cvar "resetscore_money""-1" );
    
    
g_Pointer get_cvar_pointer "mp_startmoney" );
    
}

public 
client_putinserver e_Index gi_Resete_Index ] = get_pcvar_num ToggleMax );

public 
resetscore_clcmd e_Index )
{
        new 
i_TimeCvari_Freei_GameTimeFloat:f_GameTime;
                
        if ( 
ScoreReseted e_Index ) )
        {
            
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_ALREADY_RESETED" );
            return 
PLUGIN_HANDLED;
        }
        
        
f_GameTime get_gametime ( );
        
i_GameTime floatround f_GameTime );
        
i_TimeCvar get_pcvar_num ToggleInterval );
        
        if ( ! 
get_pcvar_num ToggleMax ) )
        {
            
i_Free 1;
            goto 
CheckLimit;
            
FreeReset:
            
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_SUCCES_FREE_RESET" );
            
ResetScore e_Index );
            
gi_CanResete_Index ] = i_GameTime;
        }
        else
        {
            if ( 
gi_Resete_Index ] > )
            {
                
CheckLimit:
                if ( 
gi_CanResete_Index ] && ( i_GameTime gi_CanResete_Index ] < ( i_TimeCvar 60 ) ) )
                {
                    
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_WAIT_BEFORE_RESET"i_TimeCvar );
                    return 
PLUGIN_HANDLED;
                }
                else    
                    if ( 
i_Free )
                        goto 
FreeReset;
                    
                
gi_Resete_Index ]--;
                
gi_CanResete_Index ] = i_GameTime;
                
ResetScore e_Index );
                        
                if ( 
gi_Resete_Index ] > )
                {
                    if ( 
gi_Resete_Index ] == )
                        
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_SUCCESS_ONE_REMAIN" );
                    else    
                        
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_SUCCESS_MORE_RAMAIN"gi_Resete_Index ] );
                }
                else
                    
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_SUCCESS_NOT_REMAIN" );
                
                return 
PLUGIN_CONTINUE;
            }
            else
            {
                
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_CANT_USE_NOT_REMAIN" );
                return 
PLUGIN_HANDLED;
            }
        }
        return 
PLUGIN_CONTINUE;
}

public 
resetscore_concmd idlevelcid )
{
    if ( ! 
cmd_access idlevelcid) )
        return 
PLUGIN_HANDLED;
        
    new 
s_Arg32 ];
    
read_argv 1s_Arg31 );
    
    new 
e_Target cmd_target ids_Arg);
    if ( ! 
e_Target )
        return 
PLUGIN_HANDLED;
        
    if ( 
ScoreReseted e_Target ) )
    {
        
console_print id"%L"id"RESETSCORE_ADMIN_ALREADY_RESETED" );
        return 
PLUGIN_HANDLED;
    }
    
    
ResetScore e_Target );
    
    
client_print e_Targetprint_chat"%L"e_Target"RESETSCORE_PLAYER_ADMIN_HAS_RESETSCORE" );
    
console_print id"%L"id"RESETSCORE_ADMIN_SUCCESS_RESETED" );
    return 
PLUGIN_HANDLED;
}
bool:HasBuytimeExpired()
{
    static 
pcvarBuyTime;
    if(
pcvarBuyTime == 0)
        
pcvarBuyTime get_cvar_pointer("mp_buytime");

    new const 
Float:buyTime get_pcvar_float(pcvarBuyTime) * 60.0;

    return (
get_gametime() - get_gamerules_float("CHalfLifeMultiplay""m_fRoundStartTime") > buyTime);
}
ResetScore e_Index )
{
    if(
HasBuytimeExpired())
        
set_user_frags e_Index);
        
cs_set_user_deaths e_Index);
        
set_user_frags e_Index);
        
cs_set_user_deaths e_Index);
        new 
i_MoneyCvar get_pcvar_num ToggleMoney );
        new 
i_Value;
        
        
// make sure he won't get more money
        
if ( i_MoneyCvar >= && cs_get_user_money e_Index ) <= i_MoneyCvar )
            return 
1;
            
        switch ( 
i_MoneyCvar )
        {
            case -
2: return 1;
            case -
1i_Value get_pcvar_num g_Pointer );
            default: 
i_Value i_MoneyCvar;
        }
        
        
cs_set_user_money e_Indexi_Value );
        return 
1;
    
}

ScoreReseted e_Index )
    return  ( !
get_user_frags e_Index ) && !get_user_deaths e_Index ) ) ? 0
Error

Code:
//// resetscore_modified.sma
//
// C:\Users\GoRiLliAz2\Desktop\amxx git 5116\addons\amxmodx\scripting\resetscore
_modified.sma(159) : error 017: undefined symbol "get_gamerules_float"
// C:\Users\GoRiLliAz2\Desktop\amxx git 5116\addons\amxmodx\scripting\resetscore
_modified.sma(165) : warning 217: loose indentation
//
// 1 Error.
// Could not locate output file compiled\resetscore_modified.amx (compile failed
).
//
// Compilation Time: 0,92 sec
__________________

GoRiLliAz is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-01-2017 , 05:55   Re: How to check that the buytime and finish
Reply With Quote #14

#include <fakemeta>
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 06-01-2017 at 05:55.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
GoRiLliAz
Senior Member
Join Date: May 2013
Old 06-01-2017 , 06:18   Re: How to check that the buytime and finish
Reply With Quote #15

Thx for you help !

The plugin compiles, however I have 2 problem

Code:
L 06/01/2017 - 12:07:06: [FAKEMETA] Could not find class "CHalfLifeMultiplay" and/or member "m_fRoundStartTime" in gamedata
And the second problem is that it is blocking all the time now

PHP Code:
/*
    Copyright © 2009, aNNakin
        Suport & help : http://forums.alliedmods.net/showthread.php?t=103669
    
    ResetScore is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ResetScore; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
#include < fakemeta > 
#include < amxmodx >
#include < amxmisc >
#include < cstrike >
#include < fun >

#define PLUGIN "ResetScore"
#define VERSION "0.2.0"
#define AUTHOR "aNNakin"

new const gs_Commands[ ][ ] =
{
    
"say /rs",
    
"say_team /rs"
};

new 
ToggleMaxToggleIntervalToggleMoneyg_Pointer;
new 
gi_Reset33 ], gi_CanReset33 ];
 

public 
plugin_init ( )
{

    
register_plugin PLUGINVERSIONAUTHOR );
    
register_dictionary "resetscore.txt" );
    
    
register_concmd "amx_resetscore""resetscore_concmd"ADMIN_KICK"- <target>" );
    
    for ( new 
i_Indexi_Index sizeof gs_Commandsi_Index++ )
        
register_clcmd gs_Commandsi_Index ], "resetscore_clcmd" );
    
    
// how many times players can reset their score
    
ToggleMax register_cvar "resetscore_max""5" );
    
    
// how many minutes must pass before players can reset theirs score again
    
ToggleInterval register_cvar "resetscore_interval""3" );
    
    
// -2 don't set, -1 set at mp_startmoney value, another number will set to that value (e.g 0)
    
ToggleMoney register_cvar "resetscore_money""-1" );
    
    
g_Pointer get_cvar_pointer "mp_startmoney" );
    
}
bool:HasBuytimeExpired()
{
    static 
pcvarBuyTime;
    if(
pcvarBuyTime == 0)
        
pcvarBuyTime get_cvar_pointer("mp_buytime");

    new const 
Float:buyTime get_pcvar_float(pcvarBuyTime) * 60.0;

    return (
get_gametime() - get_gamerules_float("CHalfLifeMultiplay""m_fRoundStartTime") > buyTime);
}
public 
client_putinserver e_Index gi_Resete_Index ] = get_pcvar_num ToggleMax );

public 
resetscore_clcmd e_Index )
{
    
        new 
i_TimeCvari_Freei_GameTimeFloat:f_GameTime;
                
        if ( 
ScoreReseted e_Index ) )
        {
            
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_ALREADY_RESETED" );
            return 
PLUGIN_HANDLED;
        }
        
        
f_GameTime get_gametime ( );
        
i_GameTime floatround f_GameTime );
        
i_TimeCvar get_pcvar_num ToggleInterval );
        
        if ( ! 
get_pcvar_num ToggleMax ) )
        {
            
i_Free 1;
            goto 
CheckLimit;
            
FreeReset:
            
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_SUCCES_FREE_RESET" );
            
ResetScore e_Index );
            
gi_CanResete_Index ] = i_GameTime;
        }
        else
        {
            if ( 
gi_Resete_Index ] > )
            {
                
CheckLimit:
                if ( 
gi_CanResete_Index ] && ( i_GameTime gi_CanResete_Index ] < ( i_TimeCvar 60 ) ) )
                {
                    
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_WAIT_BEFORE_RESET"i_TimeCvar );
                    return 
PLUGIN_HANDLED;
                }
                else    
                    if ( 
i_Free )
                        goto 
FreeReset;
                    
                
gi_Resete_Index ]--;
                
gi_CanResete_Index ] = i_GameTime;
                
ResetScore e_Index );
                        
                if ( 
gi_Resete_Index ] > )
                {
                    if ( 
gi_Resete_Index ] == )
                        
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_SUCCESS_ONE_REMAIN" );
                    else    
                        
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_SUCCESS_MORE_RAMAIN"gi_Resete_Index ] );
                }
                else
                    
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_SUCCESS_NOT_REMAIN" );
                
                return 
PLUGIN_CONTINUE;
            }
            else
            {
                
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_CANT_USE_NOT_REMAIN" );
                return 
PLUGIN_HANDLED;
            }
        }
        return 
PLUGIN_CONTINUE;
}

public 
resetscore_concmd idlevelcid )
{
    if ( ! 
cmd_access idlevelcid) )
        return 
PLUGIN_HANDLED;
        
    new 
s_Arg32 ];
    
read_argv 1s_Arg31 );
    
    new 
e_Target cmd_target ids_Arg);
    if ( ! 
e_Target )
        return 
PLUGIN_HANDLED;
        
    if ( 
ScoreReseted e_Target ) )
    {
        
console_print id"%L"id"RESETSCORE_ADMIN_ALREADY_RESETED" );
        return 
PLUGIN_HANDLED;
    }
    
    
ResetScore e_Target );
    
    
client_print e_Targetprint_chat"%L"e_Target"RESETSCORE_PLAYER_ADMIN_HAS_RESETSCORE" );
    
console_print id"%L"id"RESETSCORE_ADMIN_SUCCESS_RESETED" );
    return 
PLUGIN_HANDLED;
}

ResetScore e_Index )

    if(
HasBuytimeExpired())
        
set_user_frags e_Index);
        
cs_set_user_deaths e_Index);
        
set_user_frags e_Index);
        
cs_set_user_deaths e_Index);
        new 
i_MoneyCvar get_pcvar_num ToggleMoney );
        new 
i_Value;
        
        
// make sure he won't get more money
        
if ( i_MoneyCvar >= && cs_get_user_money e_Index ) <= i_MoneyCvar )
            return 
1;
            
        switch ( 
i_MoneyCvar )
        {
            case -
2: return 1;
            case -
1i_Value get_pcvar_num g_Pointer );
            default: 
i_Value i_MoneyCvar;
        }
        
        
cs_set_user_money e_Indexi_Value );
        return 
1;
    
}

ScoreReseted e_Index )
    return  ( !
get_user_frags e_Index ) && !get_user_deaths e_Index ) ) ? 0
debug

Code:
L 06/01/2017 - 12:31:12: [FAKEMETA] Could not find class "CHalfLifeMultiplay" and/or member "m_fRoundStartTime" in gamedata
L 06/01/2017 - 12:31:12: [AMXX] Displaying debug trace (plugin "resetscore_modified.amxx", version "0.2.0")
L 06/01/2017 - 12:31:12: [AMXX] Run time error 10: native error (native "get_gamerules_float")
L 06/01/2017 - 12:31:12: [AMXX]    [0] resetscore_modified.sma::HasBuytimeExpired (line 70)
L 06/01/2017 - 12:31:12: [AMXX]    [1] resetscore_modified.sma::ResetScore (line 164)
L 06/01/2017 - 12:31:12: [AMXX]    [2] resetscore_modified.sma::resetscore_clcmd (line 113)
other test don't work block all time not just in buytime

PHP Code:
/*
    Copyright © 2009, aNNakin
        Suport & help : http://forums.alliedmods.net/showthread.php?t=103669
    
    ResetScore is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ResetScore; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
#include < fakemeta > 
#include < amxmodx >
#include < amxmisc >
#include < cstrike >
#include < fun >

#define PLUGIN "ResetScore"
#define VERSION "0.2.0"
#define AUTHOR "aNNakin"

new const gs_Commands[ ][ ] =
{
    
"say /rs",
    
"say_team /rs"
};

new 
ToggleMaxToggleIntervalToggleMoneyg_Pointer;
new 
gi_Reset33 ], gi_CanReset33 ];
 

public 
plugin_init ( )
{

    
register_plugin PLUGINVERSIONAUTHOR );
    
register_dictionary "resetscore.txt" );
    
    
register_concmd "amx_resetscore""resetscore_concmd"ADMIN_KICK"- <target>" );
    
    for ( new 
i_Indexi_Index sizeof gs_Commandsi_Index++ )
        
register_clcmd gs_Commandsi_Index ], "resetscore_clcmd" );
    
    
// how many times players can reset their score
    
ToggleMax register_cvar "resetscore_max""5" );
    
    
// how many minutes must pass before players can reset theirs score again
    
ToggleInterval register_cvar "resetscore_interval""3" );
    
    
// -2 don't set, -1 set at mp_startmoney value, another number will set to that value (e.g 0)
    
ToggleMoney register_cvar "resetscore_money""-1" );
    
    
g_Pointer get_cvar_pointer "mp_startmoney" );
    
}
bool:HasBuytimeExpired()
{
    static 
pcvarBuyTime;
    if(
pcvarBuyTime == 0)
        
pcvarBuyTime get_cvar_pointer("mp_buytime");

    new const 
Float:buyTime get_pcvar_float(pcvarBuyTime) * 60.0;

    return (
get_gametime() - get_gamerules_float("CHalfLifeMultiplay""m_fRoundStartTime") > buyTime);
}
public 
client_putinserver e_Index gi_Resete_Index ] = get_pcvar_num ToggleMax );

public 
resetscore_clcmd e_Index )
{
    
        new 
i_TimeCvari_Freei_GameTimeFloat:f_GameTime
        if ( 
ScoreReseted e_Index ) && ! HasBuytimeExpired() )
        {
            
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_ALREADY_RESETED" );
            return 
PLUGIN_HANDLED;
        }
        
        
f_GameTime get_gametime ( );
        
i_GameTime floatround f_GameTime );
        
i_TimeCvar get_pcvar_num ToggleInterval );
        
        if ( ! 
get_pcvar_num ToggleMax ) && ! HasBuytimeExpired() )
        {
            
i_Free 1;
            goto 
CheckLimit;
            
FreeReset:
            
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_SUCCES_FREE_RESET" );
            
ResetScore e_Index );
            
gi_CanResete_Index ] = i_GameTime;
        }
        else
        {
            if ( 
gi_Resete_Index ] > && ! HasBuytimeExpired() )
            {
                
CheckLimit:
                if ( 
gi_CanResete_Index ] && ( i_GameTime gi_CanResete_Index ] < ( i_TimeCvar 60 ) ) )
                {
                    
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_WAIT_BEFORE_RESET"i_TimeCvar );
                    return 
PLUGIN_HANDLED;
                }
                else    
                    if ( 
i_Free )
                        goto 
FreeReset;
                    
                
gi_Resete_Index ]--;
                
gi_CanResete_Index ] = i_GameTime;
                
ResetScore e_Index );
                        
                if ( 
gi_Resete_Index ] > )
                {
                    if ( 
gi_Resete_Index ] == )
                        
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_SUCCESS_ONE_REMAIN" );
                    else    
                        
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_SUCCESS_MORE_RAMAIN"gi_Resete_Index ] );
                }
                else
                    
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_SUCCESS_NOT_REMAIN" );
                
                return 
PLUGIN_CONTINUE;
            }
            else
            {
                
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_CANT_USE_NOT_REMAIN" );
                return 
PLUGIN_HANDLED;
            }
        }
        return 
PLUGIN_CONTINUE;
        
}

public 
resetscore_concmd idlevelcid )
{
    if ( ! 
cmd_access idlevelcid) )
        return 
PLUGIN_HANDLED;
        
    new 
s_Arg32 ];
    
read_argv 1s_Arg31 );
    
    new 
e_Target cmd_target ids_Arg);
    if ( ! 
e_Target )
        return 
PLUGIN_HANDLED;
        
    if ( 
ScoreReseted e_Target ) )
    {
        
console_print id"%L"id"RESETSCORE_ADMIN_ALREADY_RESETED" );
        return 
PLUGIN_HANDLED;
    }
    
    
ResetScore e_Target );
    
    
client_print e_Targetprint_chat"%L"e_Target"RESETSCORE_PLAYER_ADMIN_HAS_RESETSCORE" );
    
console_print id"%L"id"RESETSCORE_ADMIN_SUCCESS_RESETED" );
    return 
PLUGIN_HANDLED;
}

ResetScore e_Index )

        
set_user_frags e_Index);
        
cs_set_user_deaths e_Index);
        
set_user_frags e_Index);
        
cs_set_user_deaths e_Index);
        new 
i_MoneyCvar get_pcvar_num ToggleMoney );
        new 
i_Value;
        
        
// make sure he won't get more money
        
if ( i_MoneyCvar >= && cs_get_user_money e_Index ) <= i_MoneyCvar )
            return 
1;
            
        switch ( 
i_MoneyCvar )
        {
            case -
2: return 1;
            case -
1i_Value get_pcvar_num g_Pointer );
            default: 
i_Value i_MoneyCvar;
        }
        
        
cs_set_user_money e_Indexi_Value );
        return 
1;
    
}

ScoreReseted e_Index )
    return  ( !
get_user_frags e_Index ) && !get_user_deaths e_Index ) ) ? 0
Error

Code:
L 06/01/2017 - 12:39:14: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20170601.log")
L 06/01/2017 - 12:39:14: [FAKEMETA] Could not find class "CHalfLifeMultiplay" and/or member "m_fRoundStartTime" in gamedata
L 06/01/2017 - 12:39:14: [AMXX] Displaying debug trace (plugin "resetscore_modified.amxx", version "0.2.0")
L 06/01/2017 - 12:39:14: [AMXX] Run time error 10: native error (native "get_gamerules_float")
L 06/01/2017 - 12:39:14: [AMXX]    [0] resetscore_modified.sma::HasBuytimeExpired (line 70)
L 06/01/2017 - 12:39:14: [AMXX]    [1] resetscore_modified.sma::resetscore_clcmd (line 99)
Same thing if i del ! before HasBuytimeExpired()
__________________


Last edited by GoRiLliAz; 06-01-2017 at 06:45. Reason: More test
GoRiLliAz is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 06-01-2017 , 08:47   Re: How to check that the buytime and finish
Reply With Quote #16

Script execution aborts if an error gets thrown from a native handler, that's why it's not working properly.
Update your gamedata, you are missing files it looks like. Download the latest snapshot and you will find it in addons/amxmodx/data/gamedata.

Last edited by klippy; 06-01-2017 at 08:48.
klippy is offline
GoRiLliAz
Senior Member
Join Date: May 2013
Old 06-01-2017 , 09:27   Re: How to check that the buytime and finish
Reply With Quote #17

Code:
15:31:33 version
15:31:33 Protocol version 48
         Exe version 1.1.2.7/Stdio (cstrike)
         Exe build: 13:12:29 Aug 29 2013 (6153)
Code:
15:27:45 AMX Mod X 1.8.3-dev+5120 (http://www.amxmodx.org)
         Authors:
         <TAB>David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
         <TAB>Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
         <TAB>Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
         <TAB>Borja "faluco" Ferrer, Scott "DS" Ehlert
         Compiled: May 28 2017 13:50:02
         Built from: https://github.com/alliedmodders/amxmodx/commit/b7cb555
         Build ID: 5120:b7cb555
         Core mode: JIT+ASM32
Code:
15:29:09 Currently loaded plugins:
                name                    version     author            file             status   
          [  1] Basic Skill Points (Go  1.8.9       Arkshine          basic_skill_poi  running  
          [  2] Admin Base              1.8.3-dev+  AMXX Dev Team     admin.amxx       running  
          [  3] Admin Commands          1.8.3-dev+  AMXX Dev Team     admincmd.amxx    running  
          [  4] Admin Help              1.8.3-dev+  AMXX Dev Team     adminhelp.amxx   running  
          [  5] Slots Reservation       1.8.3-dev+  AMXX Dev Team     adminslots.amxx  running  
          [  6] Multi-Lingual System    1.8.3-dev+  AMXX Dev Team     multilingual.am  running  
          [  7] Menus Front-End         1.8.3-dev+  AMXX Dev Team     menufront.amxx   running  
          [  8] Commands Menu           1.8.3-dev+  AMXX Dev Team     cmdmenu.amxx     running  
          [  9] Players Menu            1.8.3-dev+  AMXX Dev Team     plmenu.amxx      running  
          [ 10] Maps Menu               1.8.3-dev+  AMXX Dev Team     mapsmenu.amxx    running  
          [ 11] Plugin Menu             1.8.3-dev+  AMXX Dev Team     pluginmenu.amxx  running  
          [ 12] AMXX Gag                1.5.0       xPaw & Exolent    amx_gag.amxx     running  
          [ 13] Admin Chat              1.8.3-dev+  AMXX Dev Team     adminchat.amxx   running  
          [ 14] Anti Flood              1.8.3-dev+  AMXX Dev Team     antiflood.amxx   running  
15:29:09  [ 15] Scrolling Message       1.8.3-dev+  AMXX Dev Team     scrollmsg.amxx   running  
          [ 16] Info. Messages          1.8.3-dev+  AMXX Dev Team     imessage.amxx    running  
          [ 17] Admin Votes             1.8.3-dev+  AMXX Dev Team     adminvote.amxx   running  
          [ 18] Galileo                 v5.5.0-816  Brad Jones/Addon  galileo.amxx     running  
          [ 19] Pause Plugins           1.8.3-dev+  AMXX Dev Team     pausecfg.amxx    running  
          [ 20] Stats Configuration     1.8.3-dev+  AMXX Dev Team     statscfg.amxx    running  
          [ 21] Restrict Weapons        1.8.3-dev+  AMXX Dev Team     restmenu.amxx    running  
          [ 22] StatsX                  1.8.3-dev+  AMXX Dev Team     statsx.amxx      running  
          [ 23] Lucia Hallucination     1.0         joaquimandrade    luciaHallucinat  running  
          [ 24] Auto Restart vl         1.5         vato loco [GE-S]  auto_restart_vl  running  
          [ 25] AMX SSBan               2.6         God@Dorin\Fysiks  amx_ssban.amxx   running  
          [ 26] Admin Spectator ESP     fm_1.5_bet  KoST              admin_spec_esp_  running  
          [ 27] AntiBan.cfg             0.0.1       ConnorMcLeod      anti-ban.amxx    running  
          [ 28] Reconnect Features      0.2.4 BETA  ConnorMcLeod      reconnect_featu  running  
          [ 29] xREDIRECT               1.0.3.3     x0R               xredirect.amxx   running  
15:29:10  [ 30] Files Check             1.0         ConnorMcLeod      filescheck.amxx  running  
          [ 31] MOTD Per Map            1.0         Arkshine          motd_per_map.am  running  
          [ 32] Team Balancer           1.8b3       Ptahhotep         ptb.amxx         paused   
          [ 33] Ultimate Chat           1.4         [ --{-@ ]         ultimate_chat.a  running  
          [ 34] Hobo Crontab            1.1         hoboman313        hobo_crontab.am  running  
          [ 35] CS AFK Manager          1.0.4 (amx  Freeman           afk_manager.amx  paused   
          [ 36] Bomb has been defused   1.1         xPaw              BombDefSound.am  running  
          [ 37] Bad Clients Handler     1.04        joaquimandrade/C  badClientsHandl  running  
          [ 38] C4 Management           1.0         Arkshine          c4_management.a  running  
          [ 39] WalkGuard Reborn        1.0         Arkshine          walkguard_rebor  running  
          [ 40] WG Zone: antirush_ct    1.0         Arkshine          walkguard_zone_  running  
          [ 41] WG Zone: antirush_t     1.0         Arkshine          walkguard_zone_  running  
          [ 42] WG Zone: block_all      1.0         Arkshine          walkguard_zone_  running  
          [ 43] WG Zone: block_ct       1.0         Arkshine          walkguard_zone_  running  
          [ 44] WG Zone: block_t        1.0         Arkshine          walkguard_zone_  running  
15:29:10  [ 45] WG Zone: camper         1.1         Arkshine          walkguard_zone_  running  
          [ 46] WG Zone: camper_ct      1.1         Arkshine          walkguard_zone_  running  
          [ 47] WG Zone: camper_t       1.1         Arkshine          walkguard_zone_  running  
          [ 48] WG Zone: coverbomb      1.2         Arkshine          walkguard_zone_  running  
          [ 49] WG Zone: kill_all       1.0         Arkshine          walkguard_zone_  running  
          [ 50] WG Zone: kill_ct        1.0         Arkshine          walkguard_zone_  running  
          [ 51] WG Zone: kill_t         1.0         Arkshine          walkguard_zone_  running  
          [ 52] Autoresponder/Advertis  0.5         MaximusBrood      ad_manager.amxx  running  
          [ 53] ResetScore              0.2.0       aNNakin           resetscore_modi  debug    
          [ 54] Grenade Buy Limit       1.0         Arkshine          grenade-buy-lim  running  
          [ 55] No Team Flash           1.1         Arkshine          no-team-flash.a  running  
          [ 56] Map Spawns Editor       1.0.16      iG_os             Map_Spawns_Edit  running  
          [ 57] Client Cvar Enforcer    1.0         Arkshine          client-cvar-enf  running  
          [ 58] Accuracy Fix            3.0         Numb              accuracy_fix.am  paused   
          [ 59] AWP/AUTO Limit (Team/W  1.60        SD/MG/DS/KWo      sniperlimit.amx  running  
         59 plugins, 56 running
All other plugins work fine

https://github.com/alliedmodders/amx...emultiplay.txt

No m_fRoundStartTime in the file
__________________


Last edited by GoRiLliAz; 06-01-2017 at 09:36.
GoRiLliAz is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 06-01-2017 , 12:20   Re: How to check that the buytime and finish
Reply With Quote #18

Try with "m_fRoundCount" instead. Looks like it's the same member, but the name was changed for whatever reason in ReGameDLL_CS (probably because the old name makes no sense).
klippy is offline
GoRiLliAz
Senior Member
Join Date: May 2013
Old 06-02-2017 , 03:22   Re: How to check that the buytime and finish
Reply With Quote #19

Hello,
Thank you !
It works perfectly!
Here is the change if other person wanted it

I have a last question ! Or can I find a description of the gamedata?
To know exactly what do as I start in the pawn and I plan to make small plugins to learn
Regards,


PHP Code:
/*
    Copyright © 2009, aNNakin
        Suport & help : http://forums.alliedmods.net/showthread.php?t=103669
    
    ResetScore is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ResetScore; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
    ChangeLog : 
    V0.2.1
    Add - resetscore is not possible during the buytime
*/
#include < fakemeta > 
#include < amxmodx >
#include < amxmisc >
#include < cstrike >
#include < fun >

#define PLUGIN "ResetScore"
#define VERSION "0.2.1"
#define AUTHOR "aNNakin"

new const gs_Commands[ ][ ] =
{
    
"say /rs",
    
"say_team /rs"
};

new 
ToggleMaxToggleIntervalToggleMoneyg_Pointer;
new 
gi_Reset33 ], gi_CanReset33 ];
 

public 
plugin_init ( )
{

    
register_plugin PLUGINVERSIONAUTHOR );
    
register_dictionary "resetscore.txt" );
    
    
register_concmd "amx_resetscore""resetscore_concmd"ADMIN_KICK"- <target>" );
    
    for ( new 
i_Indexi_Index sizeof gs_Commandsi_Index++ )
        
register_clcmd gs_Commandsi_Index ], "resetscore_clcmd" );
    
    
// how many times players can reset their score
    
ToggleMax register_cvar "resetscore_max""5" );
    
    
// how many minutes must pass before players can reset theirs score again
    
ToggleInterval register_cvar "resetscore_interval""3" );
    
    
// -2 don't set, -1 set at mp_startmoney value, another number will set to that value (e.g 0)
    
ToggleMoney register_cvar "resetscore_money""-1" );
    
    
g_Pointer get_cvar_pointer "mp_startmoney" );
    
}

bool:HasBuytimeExpired()
{
    static 
pcvarBuyTime;
    if(
pcvarBuyTime == 0)
        
pcvarBuyTime get_cvar_pointer("mp_buytime");

    new const 
Float:buyTime get_pcvar_float(pcvarBuyTime) * 60.0;

    return (
get_gametime() - get_gamerules_float("CHalfLifeMultiplay""m_fRoundCount") > buyTime);
}

public 
client_putinserver e_Index gi_Resete_Index ] = get_pcvar_num ToggleMax );

public 
resetscore_clcmd e_Index )
{
    new 
i_TimeCvari_Freei_GameTimeFloat:f_GameTime
    if( ! 
HasBuytimeExpired() )
    {
        
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_NOT_IN_BUYTIME" );
        return 
PLUGIN_HANDLED;
    }
    
    if ( 
ScoreReseted e_Index ) )
    {
        
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_ALREADY_RESETED" );
        return 
PLUGIN_HANDLED;
    }
    
    
f_GameTime get_gametime ( );
    
i_GameTime floatround f_GameTime );
    
i_TimeCvar get_pcvar_num ToggleInterval );
    
    if ( ! 
get_pcvar_num ToggleMax ) )
    {
        
i_Free 1;
        goto 
CheckLimit;
        
FreeReset:
        
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_SUCCES_FREE_RESET" );
        
ResetScore e_Index );
        
gi_CanResete_Index ] = i_GameTime;
    }
    else
    {
        if ( 
gi_Resete_Index ] > )
        {
            
CheckLimit:
            if ( 
gi_CanResete_Index ] && ( i_GameTime gi_CanResete_Index ] < ( i_TimeCvar 60 ) ) )
            {
                
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_WAIT_BEFORE_RESET"i_TimeCvar );
                return 
PLUGIN_HANDLED;
            }
            else    
                if ( 
i_Free )
                    goto 
FreeReset;
                
            
gi_Resete_Index ]--;
            
gi_CanResete_Index ] = i_GameTime;
            
ResetScore e_Index );
                    
            if ( 
gi_Resete_Index ] > )
            {
                if ( 
gi_Resete_Index ] == )
                    
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_SUCCESS_ONE_REMAIN" );
                else    
                    
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_SUCCESS_MORE_RAMAIN"gi_Resete_Index ] );
            }
            else
                
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_SUCCESS_NOT_REMAIN" );
            
            return 
PLUGIN_CONTINUE;
        }
        else
        {
            
client_print e_Indexprint_chat"%L"e_Index"RESETSCORE_PLAYER_CANT_USE_NOT_REMAIN" );
            return 
PLUGIN_HANDLED;
        }
    }
    return 
PLUGIN_CONTINUE;
        
}

public 
resetscore_concmd idlevelcid )
{
    if ( ! 
cmd_access idlevelcid) )
        return 
PLUGIN_HANDLED;
        
    new 
s_Arg32 ];
    
read_argv 1s_Arg31 );
    
    new 
e_Target cmd_target ids_Arg);
    if ( ! 
e_Target )
        return 
PLUGIN_HANDLED;
        
    if ( 
ScoreReseted e_Target ) )
    {
        
console_print id"%L"id"RESETSCORE_ADMIN_ALREADY_RESETED" );
        return 
PLUGIN_HANDLED;
    }
    
    
ResetScore e_Target );
    
    
client_print e_Targetprint_chat"%L"e_Target"RESETSCORE_PLAYER_ADMIN_HAS_RESETSCORE" );
    
console_print id"%L"id"RESETSCORE_ADMIN_SUCCESS_RESETED" );
    return 
PLUGIN_HANDLED;
}

ResetScore e_Index )

        
set_user_frags e_Index);
        
cs_set_user_deaths e_Index);
        
set_user_frags e_Index);
        
cs_set_user_deaths e_Index);
        new 
i_MoneyCvar get_pcvar_num ToggleMoney );
        new 
i_Value;
        
        
// make sure he won't get more money
        
if ( i_MoneyCvar >= && cs_get_user_money e_Index ) <= i_MoneyCvar )
            return 
1;
            
        switch ( 
i_MoneyCvar )
        {
            case -
2: return 1;
            case -
1i_Value get_pcvar_num g_Pointer );
            default: 
i_Value i_MoneyCvar;
        }
        
        
cs_set_user_money e_Indexi_Value );
        return 
1;
    
}

ScoreReseted e_Index )
    return  ( !
get_user_frags e_Index ) && !get_user_deaths e_Index ) ) ? 0
Lang File :

HTML Code:
[en]
RESETSCORE_NOT_IN_BUYTIME = Forbidden during the buytime!
RESETSCORE_PLAYER_ALREADY_RESETED =  Your score is already reseted!
RESETSCORE_PLAYER_WAIT_BEFORE_RESET =  You must wait %d minute(s) since your last score reset to do that again
RESETSCORE_PLAYER_SUCCESS_ONE_REMAIN =  Score successfully reseted ; you may use this command only once
RESETSCORE_PLAYER_SUCCESS_MORE_RAMAIN =  Score successfully reseted ; you may use this command %d times
RESETSCORE_PLAYER_SUCCESS_NOT_REMAIN =  Score successfully reseted ; you won't be able to use this command anymore
RESETSCORE_PLAYER_CANT_USE_NOT_REMAIN =  You've used this command too much, therefore you can't use it anymore!
RESETSCORE_PLAYER_ADMIN_HAS_RESETSCORE =  The admin has reset your score
RESETSCORE_PLAYER_SUCCES_FREE_RESET =  Score successfully reseted
RESETSCORE_ADMIN_ALREADY_RESETED =  The players's score is already reseted
RESETSCORE_ADMIN_SUCCESS_RESETED =  Successfully reseted score.

[nl]
RESETSCORE_NOT_IN_BUYTIME = Verboden tijdens de aankoop van wapens!
RESETSCORE_PLAYER_ALREADY_RESETED =  Jouw score is reeds terug gezet!
RESETSCORE_PLAYER_WAIT_BEFORE_RESET =  Je moet %d minute(n) sinds je laatste terugzetting van de score om het opnieuw te doen.
RESETSCORE_PLAYER_SUCCESS_ONE_REMAIN =  Score succesvol teruggezet ; je mag dit commando maar 1 keer gebruiken.
RESETSCORE_PLAYER_SUCCESS_MORE_RAMAIN =  Score succesvol teruggezet ; je mag dit commando %d keren gebruiken.
RESETSCORE_PLAYER_SUCCESS_NOT_REMAIN =  Score succesvol teruggezet ; je zal dit commando niet meer kunnen gebruiken.
RESETSCORE_PLAYER_CANT_USE_NOT_REMAIN =  Je gebruikte dit commando te veel, daarvoor kan je het niet meer gebruiken!
RESETSCORE_PLAYER_ADMIN_HAS_RESETSCORE =  De beheerder heeft je score teruggezet.
RESETSCORE_PLAYER_SUCCES_FREE_RESET =  Score succesvol teruggezet
RESETSCORE_ADMIN_ALREADY_RESETED =  De score van de speler is reeds teruggezet.
RESETSCORE_ADMIN_SUCCESS_RESETED =  Score succesvol teruggezet. 

[es]
RESETSCORE_NOT_IN_BUYTIME = Prohibido durante la compra de armas!
RESETSCORE_PLAYER_ALREADY_RESETED =  Tu puntuacion ya ha sido reiniciada!
RESETSCORE_PLAYER_WAIT_BEFORE_RESET =  Debes esperar %d minuto(s) desde el ultimo reinicio para poder hacer esto otra vez
RESETSCORE_PLAYER_SUCCESS_ONE_REMAIN =  Puntuacion reiniciada ; puedes usar este comando una vez
RESETSCORE_PLAYER_SUCCESS_MORE_RAMAIN =  Puntuacion reiniciada ; puedes usar este comando %d veces mas
RESETSCORE_PLAYER_SUCCESS_NOT_REMAIN =  Puntuacion reiniciada ; no puedes usar mas este comando
RESETSCORE_PLAYER_CANT_USE_NOT_REMAIN =  Has usado este comando muchas veces, asi que no lo puedes volver a utilizar!
RESETSCORE_PLAYER_ADMIN_HAS_RESETSCORE =  El admin ha reiniciado tu puntuacion
RESETSCORE_PLAYER_SUCCES_FREE_RESET =  Puntuacion reiniciada
RESETSCORE_ADMIN_ALREADY_RESETED =  La puntuacion del jugador ya esta reiniciada
RESETSCORE_ADMIN_SUCCESS_RESETED = Puntuacion reiniciada satisfactoriamente.

[fr]
RESETSCORE_NOT_IN_BUYTIME = Interdit durant l'achat des armes!
RESETSCORE_PLAYER_ALREADY_RESETED = Ton score à étais remis à zéro!
RESETSCORE_PLAYER_WAIT_BEFORE_RESET = Vous devez attendre %d minute (s) depuis votre dernier score pour recommencer
RESETSCORE_PLAYER_SUCCESS_ONE_REMAIN = Votre score est reset, vous pouvez utiliser cette commande qu'une seule fois
RESETSCORE_PLAYER_SUCCESS_MORE_RAMAIN = Votre score est reset, vous pouvez utiliser cette commande %d fois
RESETSCORE_PLAYER_SUCCESS_NOT_REMAIN = Votre score est reset, vous ne pouvez plus utiliser cette commande
RESETSCORE_PLAYER_CANT_USE_NOT_REMAIN = Vous avez trop utilisé cette commande, vous ne pouvez plus l'utiliser !
RESETSCORE_PLAYER_ADMIN_HAS_RESETSCORE = L'admin a réinitialisé votre score
RESETSCORE_PLAYER_SUCCES_FREE_RESET = Votre score est reset
RESETSCORE_ADMIN_ALREADY_RESETED = Le score des joueurs est déjà réinitialisées
RESETSCORE_ADMIN_SUCCESS_RESETED = Le score est bien reset
__________________


Last edited by GoRiLliAz; 06-02-2017 at 03:25.
GoRiLliAz 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 10:02.


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