Raised This Month: $ Target: $400
 0% 

[Orpheu] Getting structmember value?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Simo123
Junior Member
Join Date: Feb 2009
Old 10-05-2014 , 00:01   Re: [Orpheu] Getting structmember value?
Reply With Quote #1

Quote:
Originally Posted by Arkshine View Post
This is supposed to be a float value (f for float), and you don't retrieve value as a float.

About your error, no idea, you better show all your code as it is, so we can understand better what you're doing.
PHP Code:
#include <amxmodx>
#include <orpheu>
#include <hlsdk_const>

#define VERSION "1.7.2"

new Float:oldMaxSpeed
new OrpheuStruct:ppmove

public plugin_init()
{
    
register_plugin("axn bhop"VERSION"aportner & ConnorMcLeod")
    new 
szVersion[12]
    
formatex(szVersioncharsmax(szVersion), "%s_Orpheu"VERSION)
    
register_cvar("axn_version"szVersionFCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)

    
OrpheuRegisterHook(OrpheuGetFunction("PM_Move"), "onPMMovePre"OrpheuHookPre)
    
OrpheuRegisterHook(OrpheuGetFunction("PM_Jump"), "onPMJumpPre"OrpheuHookPre)
    
OrpheuRegisterHook(OrpheuGetFunction("PM_Jump"), "onPMJumpPost"OrpheuHookPost)
    
//    OrpheuRegisterHook(OrpheuGetFunction("PM_PlayerMove"), "onPMPlayerMovePre", OrpheuHookPre)
    
OrpheuRegisterHook(OrpheuGetFunction("PM_Duck"), "onPMDuckPost"OrpheuHookPost)
}

public 
onPMMovePre(OrpheuStruct:pmove,server)
{
    
ppmove pmove
}

public 
onPMJumpPre()
{
    
// bhop acceleration
    
oldMaxSpeed Float:OrpheuGetStructMember(ppmove"maxspeed")
    
OrpheuSetStructMember(ppmove"maxspeed"0.0)
}

public 
onPMJumpPost()
{
    
/* Here's my code */
    
new Float:fuser3[3]
    
OrpheuGetStructMember(ppmove"fuser2"fuser3)

    
client_print(0print_chat"fuser2: %f"fuser3[2]) // example

    /* Here's my code */

    // remove fuser2 slowdown
    
OrpheuSetStructMember(ppmove"fuser2"0.0)

    
// restore maxspeed from acceleration
    
OrpheuSetStructMember(ppmove"maxspeed"oldMaxSpeed)
}

/*public onPMPlayerMovePre()
{
    
}*/

public onPMDuckPost()
{
    if(    
OrpheuGetStructMember(ppmove"onground") != -1
    
&&    OrpheuGetStructMember(OrpheuStruct:OrpheuGetStructMemberppmove"cmd" ), "buttons" ) & IN_USE    )
    {
        new 
Float:fVecVelocity[3]
        
OrpheuGetStructMember(ppmove"velocity"fVecVelocity)
        
fVecVelocity[0] *= 0.3
        fVecVelocity
[1] *= 0.3
        fVecVelocity
[2] *= 0.3
        OrpheuSetStructMember
(ppmove"velocity"fVecVelocity)
    }

That gives me a Invalid structure error, on a sidenote I think the "onPMDuckPost()" function is not working, and he does the exactly same under there
PHP Code:
new Float:fVecVelocity[3]
OrpheuGetStructMember(ppmove"velocity"fVecVelocity
I just wanna grab the value of fuser2 and print it out.
And here's the PM_Duck file which I'm using (since it's not included when you download Orpheu): https://forums.alliedmods.net/showthread.php?t=118476
Taken from joaquims PM_Pack.

Last edited by Simo123; 10-05-2014 at 00:05.
Simo123 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 17:40.


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