Raised This Month: $ Target: $400
 0% 

[Orpheu] Weapon respawn delay


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
teh ORiON
Member
Join Date: Sep 2011
Location: Denmark
Old 10-25-2012 , 11:55   [Orpheu] Weapon respawn delay
Reply With Quote #1

Hi,

I'm trying to change the delay at which weapons respawn in TFC. Currently it is 20 seconds, but I want it at 1 second or so. Here is what I've got.

PHP Code:
#include <amxmodx>
#include <orpheu>
#include <orpheu_stocks>

new g_pGameRules

public plugin_precache()
{
    
OrpheuRegisterHook(OrpheuGetFunction("InstallGameRules_tfc"),"OnInstallGameRules",OrpheuHookPost)
}

public 
plugin_init()
{
    
OrpheuRegisterHookFromObject(g_pGameRules,"FlWeaponRespawnTime","CGameRules","OnWeaponRespawn",OrpheuHookPre)
}

public 
OnInstallGameRules()
{
    
g_pGameRules OrpheuGetReturn() 
}

public 
OrpheuHookReturn:OnWeaponRespawn(gameRules,weaponID)
{
    
OrpheuSetReturn(get_gametime()+1.0)
    return 
OrpheuOverride

Was assuming this would work but it doesn't, the weapons will still respawn after 20 seconds. What am I missing here?

Code from SDK:

PHP Code:
#define WEAPON_RESPAWN_TIME    20

//=========================================================
// FlWeaponRespawnTime - what is the time in the future
// at which this weapon may spawn?
//=========================================================
float CHalfLifeMultiplay :: FlWeaponRespawnTimeCBasePlayerItem *pWeapon )
{
    if ( 
weaponstay.value )
    {
        
// make sure it's only certain weapons
        
if ( !(pWeapon->iFlags() & ITEM_FLAG_LIMITINWORLD) )
        {
            return 
gpGlobals->time 0;        // weapon respawns almost instantly
        
}
    }

    return 
gpGlobals->time WEAPON_RESPAWN_TIME;

teh ORiON is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-25-2012 , 12:31   Re: [Orpheu] Weapon respawn delay
Reply With Quote #2

No error ? Function is well called ?
__________________
Arkshine is offline
teh ORiON
Member
Join Date: Sep 2011
Location: Denmark
Old 10-25-2012 , 13:26   Re: [Orpheu] Weapon respawn delay
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
No error ? Function is well called ?
Yes, I can supercede the function and the weapon will never respawn just fine. I can also get the return value which also looks fine.
teh ORiON is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-25-2012 , 14:11   Re: [Orpheu] Weapon respawn delay
Reply With Quote #4

Hook as pre and change nothing else, it should work so.
__________________
Arkshine is offline
teh ORiON
Member
Join Date: Sep 2011
Location: Denmark
Old 10-25-2012 , 14:37   Re: [Orpheu] Weapon respawn delay
Reply With Quote #5

Quote:
Originally Posted by Arkshine View Post
Hook as pre and change nothing else, it should work so.
How do you mean? I am currently hooking it in pre.
teh ORiON is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-25-2012 , 14:55   Re: [Orpheu] Weapon respawn delay
Reply With Quote #6

Ah, yes, sorry.

If well called, it should work. Maybe you should set your value before in a variable instead of writing directly inside the native. Desperate idea, but I can't see what's wrong here.
__________________
Arkshine is offline
teh ORiON
Member
Join Date: Sep 2011
Location: Denmark
Old 10-25-2012 , 15:17   Re: [Orpheu] Weapon respawn delay
Reply With Quote #7

Quote:
Originally Posted by Arkshine View Post
Ah, yes, sorry.

If well called, it should work. Maybe you should set your value before in a variable instead of writing directly inside the native. Desperate idea, but I can't see what's wrong here.
Yeah I've already tried that, tried everything I could think of. It's weird as you say, it seems like it should work.
teh ORiON is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-25-2012 , 16:21   Re: [Orpheu] Weapon respawn delay
Reply With Quote #8

Are you sure you don't confuse with items ? I mean what you want to change are more the items.
__________________

Last edited by Arkshine; 10-25-2012 at 16:29.
Arkshine is offline
teh ORiON
Member
Join Date: Sep 2011
Location: Denmark
Old 10-25-2012 , 16:53   Re: [Orpheu] Weapon respawn delay
Reply With Quote #9

Quote:
Originally Posted by Arkshine View Post
Are you sure you don't confuse with items ? I mean what you want to change are more the items.
Yeah well, the function gets called when I pick up a weapon e.g. a spanner or a RPG, and it returns the current game time + 20 seconds, so I figure it must be the correct function.
teh ORiON is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-25-2012 , 16:58   Re: [Orpheu] Weapon respawn delay
Reply With Quote #10

I've tried the game, I don't know much about it, but I don't see weapon on the ground, except probably at spawn but you pickup right away. That's why I thought you might talk about the items around the maps, is it not the case ? Yes, it's well called, and there is no reason altering time is not working unless you're trying to respawn the wrong thing.
__________________

Last edited by Arkshine; 10-25-2012 at 17:01.
Arkshine 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 15:24.


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