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

Round Bonus Remover v1.3 ( Remove Bonus For Win/Lose Rounds)


Post New Thread Reply   
 
Thread Tools Display Modes
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-04-2021 , 14:33   Re: Round Bonus Remover v1.3 ( Remove Bonus For Win/Lose Rounds)
Reply With Quote #21

Thanks for providing the code, now I see why you were confused. However, as I said, the code is wrong. Ham_Spawn is executed per player so it has an "id" argument.
PHP Code:
public e_Player_Spawn(id
Therefore, the task and iterating over players is not needed. You can simply do:

PHP Code:
public e_Player_Spawn(id)
{
    if(
is_user_alive(id))
    {
              
strip_user_weaponsid);
              
give_itemid"weapon_knife" );
              
give_itemid"weapon_awp" );
              
cs_set_user_bpammoidCSW_AWP 30 );
    }

Now you should not notice any delays. The behavior you described makes perfect sense with your original code, but it's caused, as I said, by the wrong code. Try what I proposed and see that it should work just fine.
I removed the team check because it is no longer needed: an alive, spawned player will either be tero or ct.

Also, I suggest you read this: https://forums.alliedmods.net/showthread.php?t=42159

To explain more about caching: a loop is executed multiple times. If values do not change between loop iterations then it's better to cache(save) them before the loop. This helps you avoid repeated native calls that will produce the same output. As a result, your code will be a bit faster. Assume you wanted to run a native that takes 1 second to run inside a loop that runs 32 times. This means that the time taken by that native is 32 runs * 1s per run = 32s. Now, if you cache the native before the loop, the whole run time of that native is only 1s. That's 32 times better.
__________________

Last edited by HamletEagle; 09-04-2021 at 14:40.
HamletEagle is offline
WATCH_DOGS UNITED
BANNED
Join Date: Nov 2020
Old 09-04-2021 , 15:59   Re: Round Bonus Remover v1.3 ( Remove Bonus For Win/Lose Rounds)
Reply With Quote #22

Thanks for explaining more about caching cvars, it's probably correct in the Aim Realsm code.

We've already seen the Player Spawn VEN tutorial several times while trying to fix this issue.

But your code just removed the 1.0 delay and do not make any difference for the problem. In the way you code only our player is receiving AWP. Are you testing offline? Because we test with bots but we know that is not the reason stills not working as if we make a check is_user_bot has no difference.

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>


#define OFFSET_AWP_AMMO 377

public plugin_init()
{
    
register_plugin"Only AWP MOD" "0.1" "N/A" );
    
RegisterHam(Ham_Spawn"player""e_Player_Spawn"1);


public 
e_Player_Spawn(id)
{
    if(
is_user_alive(id))
    {
              
strip_user_weaponsid);
              
give_itemid"weapon_knife" );
              
give_itemid"weapon_awp" );
              
cs_set_user_bpammoidCSW_AWP 30 );
    }

WATCH_DOGS UNITED is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-04-2021 , 17:52   Re: Round Bonus Remover v1.3 ( Remove Bonus For Win/Lose Rounds)
Reply With Quote #23

Ham_Spawn is not called for bots directly(podbot for example). If you want to go around this use RegisterHamFromEntity with a bot id(obtain it from client_putinserver + is_user_bot). Or just get another real player to convince yourself there is no issue.
I did more than removing the delay. I also removed the get_players loop since it is not needed. I'll say this again: Ham_Spawn is called FOR EACH INDIVIDUAL PLAYER, meaning for 32 players the forward will fire 32 times and each time the "id" parameter is going to refer to a different player.
__________________

Last edited by HamletEagle; 09-04-2021 at 17:53.
HamletEagle is offline
WATCH_DOGS UNITED
BANNED
Join Date: Nov 2020
Old 09-04-2021 , 19:51   Re: Round Bonus Remover v1.3 ( Remove Bonus For Win/Lose Rounds)
Reply With Quote #24

You're right. About using client_putinserver, we've already done that, but the last bot to come up wasn't affected, so we've given up.

Last edited by WATCH_DOGS UNITED; 09-04-2021 at 20:30.
WATCH_DOGS UNITED is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-05-2021 , 03:04   Re: Round Bonus Remover v1.3 ( Remove Bonus For Win/Lose Rounds)
Reply With Quote #25

Thi is again an issue with the code. You only have to register once, with the first bot, not for all of them. I will provide you with some code, a bit later.
__________________

Last edited by HamletEagle; 09-05-2021 at 03:04.
HamletEagle is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 09-06-2021 , 09:02   Re: Round Bonus Remover v1.3 ( Remove Bonus For Win/Lose Rounds)
Reply With Quote #26

Why don't use m_bReceivesNoMoneyNextRound Offset?
PHP Code:
/* Sublime AMXX Editor v4.2 */

#include <amxmodx>
#include <fakemeta>

#define PLUGIN  "Round Bonus Remover"
#define VERSION "1.0"
#define AUTHOR  "Shadows Adi"

// Windows Offset Value
const m_bReceivesNoMoneyNextRound 890

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("HLTV""Ev_NewRound""a""1=0""2=0")
}

public 
Ev_NewRound()
{
    new 
iPlayers[MAX_PLAYERS], iNum
    get_players
(iPlayersiNum"ch")

    for(new 
iiNumi++)
    {
        
// +20 offset value for linux: 910
        
set_pdata_bool(iPlayers[i], m_bReceivesNoMoneyNextRoundtrue20)
    }

Not tested, but should work just fine.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
WATCH_DOGS UNITED
BANNED
Join Date: Nov 2020
Old 09-06-2021 , 09:38   Re: Round Bonus Remover v1.3 ( Remove Bonus For Win/Lose Rounds)
Reply With Quote #27

Quote:
Originally Posted by Shadows Adi View Post
Why don't use m_bReceivesNoMoneyNextRound Offset?


Not tested, but should work just fine.
Because we hadn't heard of this function. It's working fine. Thanks for the code.

Where did you see that? We didn't find this function here on the forum.

EDIT:

Your code works fine, but it's not the same case here. Round Bonus Remover plugin is an abstraction of the Money Manager plugin so we can control the bonus for win/lose rounds. Your code does not allow to add the new bonus values as it definitely blocks players from receiving any money. We won't be able to use it.

We are currently constantly optimizing the Money Manager code so that it keeps working on AMXX v1.8.2 v1.9.0 and v1.10. We will update the plugin soon.

EDIT: Oops... working correctly, please ignore the last edit.

Last edited by WATCH_DOGS UNITED; 09-06-2021 at 10:42. Reason: Not the same thing.
WATCH_DOGS UNITED is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-06-2021 , 09:54   Re: Round Bonus Remover v1.3 ( Remove Bonus For Win/Lose Rounds)
Reply With Quote #28

Relevant code here: https://github.com/s1lentq/ReGameDLL...ules.cpp#L1987
You can see that if m_bReceivesNoMoneyNextRound is true then AddAccount will not be called, meaning players will not receive round bonuses.
Also, note that for amxx < 1.9 you need Connor's stock for set_pdata_bool. Also, if I remember correctly, with Connor's stock you need to pass the full offset but the "converted" extra offset(which is 20 / 4 = 5), which is a bit confusing.

Another example code from this forum, from 2014: https://forums.alliedmods.net/showthread.php?t=233836
__________________

Last edited by HamletEagle; 09-06-2021 at 09:55.
HamletEagle is offline
WATCH_DOGS UNITED
BANNED
Join Date: Nov 2020
Old 09-06-2021 , 10:19   Re: Round Bonus Remover v1.3 ( Remove Bonus For Win/Lose Rounds)
Reply With Quote #29

Quote:
Originally Posted by HamletEagle View Post
Relevant code here: https://github.com/s1lentq/ReGameDLL...ules.cpp#L1987
You can see that if m_bReceivesNoMoneyNextRound is true then AddAccount will not be called, meaning players will not receive round bonuses.
Also, note that for amxx < 1.9 you need Connor's stock for set_pdata_bool. Also, if I remember correctly, with Connor's stock you need to pass the full offset but the "converted" extra offset(which is 20 / 4 = 5), which is a bit confusing.

Another example code from this forum, from 2014: https://forums.alliedmods.net/showthread.php?t=233836
Thanks. We edited the above post as the code that Shadows Adi passed on is not the same thing as the Round Bonus Remover.

EDIT:

Working correctly with Money Manager.

Last edited by WATCH_DOGS UNITED; 09-06-2021 at 10:45.
WATCH_DOGS UNITED is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 09-06-2021 , 11:21   Re: Round Bonus Remover v1.3 ( Remove Bonus For Win/Lose Rounds)
Reply With Quote #30

Quote:
Originally Posted by WATCH_DOGS UNITED View Post
Because we hadn't heard of this function. It's working fine. Thanks for the code.

Where did you see that? We didn't find this function here on the forum.

EDIT:

Your code works fine, but it's not the same case here. Round Bonus Remover plugin is an abstraction of the Money Manager plugin so we can control the bonus for win/lose rounds. Your code does not allow to add the new bonus values as it definitely blocks players from receiving any money. We won't be able to use it.

We are currently constantly optimizing the Money Manager code so that it keeps working on AMXX v1.8.2 v1.9.0 and v1.10. We will update the plugin soon.

EDIT: Oops... working correctly, please ignore the last edit.
Got it from gamedata: https://github.com/alliedmodders/amx....txt#L618-L625
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
Reply


Thread Tools
Display Modes

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 04:23.


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