AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   General (https://forums.alliedmods.net/forumdisplay.php?f=7)
-   -   [ISSUE][AMXX + REGAME] get_gamerules_* (https://forums.alliedmods.net/showthread.php?t=303326)

Depresie 12-02-2017 17:52

[ISSUE][AMXX + REGAME] get_gamerules_*
 
I don't know if this should be fixed on amxx or regame side
It seems that the get_gamerules_* natives works properly without ReGame, but when you use them with ReGame they don't return the proper values

ITerrors - value seems to equal 0 even tho i am a terrorist while i call it
iRoundTime - value some crazy long int number
iSpawnPoints - value equals the number of terrorists instead of terrorist spawn points

Also, i noticed m_flRestartRoundTime offset is missing from CHalfLifeMultiplay gamedata
https://github.com/s1lentq/ReGameDLL...ls/gamerules.h

PHP Code:

public plugin_init()
{
    
register_plugin("Plugin Test""1.0""Depresie")

    
register_clcmd("say test1""clcmdtest1")
}


public 
clcmdtest1(iPlayer)
{
    new 
iRoundTerminating get_gamerules_int("CHalfLifeMultiplay""m_bRoundTerminating")
    new 
iTerrors get_gamerules_int("CHalfLifeMultiplay""m_iNumTerrorist")
    new 
iRoundTime get_gamerules_int("CHalfLifeMultiplay""m_iRoundTime")
    new 
iSpawnPoints get_gamerules_int("CHalfLifeMultiplay""m_iSpawnPointCount_Terrorist")


    
client_print(0print_chat"Round Time -> %i"iRoundTime)
    
client_print(0print_chat"Terrorists -> %i"iTerrors)
    
client_print(0print_chat"Spawn Points -> %i"iSpawnPoints)




NiHiLaNTh 12-03-2017 12:00

Re: [ISSUE][AMXX + REGAME] get_gamerules_*
 
AFAK get_gamerules relies on specific memory adresses, and unfortunately ReGameDLL obviosuly have different adresses. And AFAIK ReGameDLL has it's own natives to access the gamerules members.

klippy 12-03-2017 12:49

Re: [ISSUE][AMXX + REGAME] get_gamerules_*
 
Quote:

Also, i noticed m_flRestartRoundTime offset is missing from CHalfLifeMultiplay gamedata
https://github.com/s1lentq/ReGameDLL...ls/gamerules.h
Read the comment next to member's definition:
Code:

// The global time when the round is supposed to end, if this is not 0 (deprecated name m_fTeamCount)

Depresie 12-03-2017 13:04

Re: [ISSUE][AMXX + REGAME] get_gamerules_*
 
So basically the offsets related to game rules are different in ReGame ? the ones related to CBasePlayer are the same tho

Well, i guess i will switch out from ReGame until it is fully compatible with amxmodx

klippy 12-03-2017 13:32

Re: [ISSUE][AMXX + REGAME] get_gamerules_*
 
It should work, there's support for ReGameDLL and AMXX does get the address of the gamerules object. When you use those gamerules natives, if they don't throw any runtime error then the gamerules object was successfully found.
Offsets may be different though.

Arkshine 12-03-2017 15:38

Re: [ISSUE][AMXX + REGAME] get_gamerules_*
 
^ this and if you're using ReGameDLL, you should probably use ReAPI module instead, there is less chance you face a wrong offset since it has been designed to work directly with ReGameDLL. In AMXX, the compatibility is just about getting the gamerules object. The offsets that you have in your gamedata/ dir are from a dump of the original CS version.

Depresie 12-03-2017 17:10

Re: [ISSUE][AMXX + REGAME] get_gamerules_*
 
I'd rather rely mainly on amxx than on regame, amxx is mandatory for a server while regame is not, so in case things get screwed and i have to use the stock dll, i don't have to rewrite everything..

Arkshine 12-03-2017 17:37

Re: [ISSUE][AMXX + REGAME] get_gamerules_*
 
As said Klippy, it should work. It doesn't matter if the name has changed as long the position (offset) is the same. Check with and without ReGameDLL in the same context, or try to use ReAPI just to see if you get the same value.

PRoSToTeM@ 12-03-2017 20:35

Re: [ISSUE][AMXX + REGAME] get_gamerules_*
 
Unfortunately, ReGameDLL has 2 custom fields in CGameRules. So looks like all fields of CHalfLifeMultiplay are shifted by 8 bytes.

Depresie 12-03-2017 22:22

Re: [ISSUE][AMXX + REGAME] get_gamerules_*
 
I specified that i tried with and without regame
Without regame the values that were returned are correct
With regame the values that were returned were incorrect

As Prostostem@ said, the get_gamerules_* natives are incompatible with regame, since the offsets were shifted by 8 bytes..


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

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