reapi icon indicating copy to clipboard operation
reapi copied to clipboard

rg_set_account_rules not working properly?

Open OciXCrom opened this issue 8 years ago • 5 comments

Is this function not working at all or I misunderstood what it does? Does it change the default money rewards, or it does something else? I tried using rg_set_account_rules(RR_CTS_WIN, 666) in plugin_init() but I didn't get the 666 reward when playing as CT and winning the round. Same goes for all other account types. rg_get_account_rules() however displays the changed value.

OciXCrom avatar Apr 29 '17 20:04 OciXCrom

May be bomb was defused. m_iAccountCT += m_rgRewardAccountRules[m_bMapHasBombTarget ? RR_BOMB_DEFUSED : RR_CTS_WIN]; https://github.com/s1lentq/ReGameDLL_CS/blob/6186ae56c8dd9e0d6e85071b82688cc059b15e55/regamedll/dlls/multiplay_gamerules.cpp#L1362

WPMGPRoSToTeMa avatar Apr 29 '17 20:04 WPMGPRoSToTeMa

That worked, but it's not supposed to be like that. There was no bomb planted on the map, so it should use RR_CTS_WIN. I see that it checks if the map has a bomb target, so either the code is wrong or the name of the const. RR_BOMB_DEFUSED should be given when the bomb is defused, and RR_CTS_WIN if there was no bomb at all. Also, another thing - changing the account rules once makes them stay forever. After removing the plugin, restarting the map, even shutting down the server and starting it again - the modified values are still there.

OciXCrom avatar Apr 29 '17 20:04 OciXCrom

changing the account rules once makes them stay forever. After removing the plugin, restarting the map, even shutting down the server and starting it again - the modified values are still there.

LoL you sure you removed the plugin ?

justgo97 avatar Apr 29 '17 20:04 justgo97

I didn't actually remove it, but I commented the lines that change the account rules, which is the same.

OciXCrom avatar Apr 29 '17 21:04 OciXCrom

I set RR_BOMB_EXPLODED to 333 and RR_TERRORISTS_WIN to 444. I planted the bomb and I let it explode. On the next round I had 4300$ (previously they were 800$), which means I didn't get any of the rewards.

According to this line in multiplay_gamerules.cpp:

m_iAccountTerrorist += m_rgRewardAccountRules[m_bMapHasBombTarget ? RR_BOMB_EXPLODED : RR_TERRORISTS_WIN];

... the terrorists will receive the RR_BOMB_EXPLODED amount if the map has a bomb target independent of whether the bomb exploded or not and they will receive RR_TERRORISTS_WIN amount if the map doesn't have a bomb target. What this means is, the terrorists will receive RR_BOMB_EXPLODED on de_* maps if they killed all the Counter-Terrorists without planting the bomb. However none of the two are given, even though checking the value with rg_get_account_rules returns the changed value. Same goes for CTs and defusing it. The code is wrong.

OciXCrom avatar Apr 30 '17 13:04 OciXCrom