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

Compiling AMXX Module


Post New Thread Reply   
 
Thread Tools Display Modes
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 09-24-2015 , 03:56   Re: Compiling AMXX Module
Reply With Quote #21

I'm encountering an issue where variables from a separate plugin seems to infecting another. In the attached screenshot, I have one forward which prints the parameters, and in another I am operating on those forwards (not changing, as they are consts). It seems that some of the values overwrite those which are printed within the other.

Under what conditions can something like this occur?

Note: When the plugin on the right is disabled, this does not occur (expected).

My forward is declared as
Code:
LoggerCreatedForward = registerForward("OnLoggerCreated", ET_IGNORE,
    FP_CELL, FP_CELL, FP_STRING, FP_STRING, FP_STRING, FP_STRING, FP_STRING, FP_STRING, FP_STRING, FP_DONE);
My forward is executed as
Code:
executeForwards(LoggerCreatedForward,
    loggerHandle, <- this is of type cell
    static_cast<cell>(verbosity),
    pluginFile2,
    nameFormat,
    msgFormat,
    dateFormat,
    timeFormat,
    pathFormat,
    traceFormat);
And my forward decl is
Code:
forward OnLoggerCreated(
    const Logger: logger,
    const Severity: verbosity,
    const name[],
    const nameFormat[],
    const msgFormat[],
    const dateFormat[],
    const timeFormat[],
    const pathFormat[],
    const traceFormat[]);
Attached Files
File Type: zip screenshot.zip (947.9 KB, 54 views)
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-24-2015 , 08:58   Re: Compiling AMXX Module
Reply With Quote #22

Seems like related to AMXX buffer, but is your code somewhere?
__________________
Arkshine is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 09-24-2015 , 09:15   Re: Compiling AMXX Module
Reply With Quote #23

Debugging a module issue can prove impossible without good repro code or a proper snippet. C++ modules can do basically anything to fuck things up, so if you really need good advice you should start giving us code.

My best guess would be that you are using get_amxstring() (which uses static buffers) for your forward parameters. This is dangerous because when plugin use natives from inside your callback, those natives will re-use those buffers for themselves. If this is the case here you should be using get_amxstring_r() to move the strings into your own buffers.
__________________
In Flames we trust!
Nextra is offline
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 09-24-2015 , 11:09   Re: Compiling AMXX Module
Reply With Quote #24

It looks like you may be correct about amx get string.

github.com/collinsmith/amxmodx (master)
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]

Last edited by Tirant; 09-24-2015 at 11:09.
Tirant is offline
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 09-24-2015 , 23:18   Re: Compiling AMXX Module
Reply With Quote #25

Quote:
Originally Posted by Nextra View Post
Debugging a module issue can prove impossible without good repro code or a proper snippet. C++ modules can do basically anything to fuck things up, so if you really need good advice you should start giving us code.

My best guess would be that you are using get_amxstring() (which uses static buffers) for your forward parameters. This is dangerous because when plugin use natives from inside your callback, those natives will re-use those buffers for themselves. If this is the case here you should be using get_amxstring_r() to move the strings into your own buffers.
Thank you for your suggestion, that did the trick.
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 09-25-2015 , 01:47   Re: Compiling AMXX Module
Reply With Quote #26

I think it's ready for someone to take a look at it. Please let me know any questions, comments, improvements, ideas that you have, or changes that you think should be made.

https://github.com/collinsmith/amxmodx
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant 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:02.


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