AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ham_ResetSpeed (https://forums.alliedmods.net/showthread.php?t=164230)

Doc-Holiday 08-08-2011 21:51

Ham_ResetSpeed
 
using the following code

PHP Code:

public fwdPlayerResetMaxSpeedPost(id)
{
        new 
iClass g_XP[id][Class];
        new 
iRank g_XP[id][Rank];
        new 
weapon get_user_weapon(id);
    
        if(
iClass == CLASS_NONE)
            return 
HAM_IGNORED;
        
        if(!
weapon)
            return 
HAM_IGNORED;
        
        new 
szWeaponName[32];
        
get_weaponname(weaponszWeaponNamecharsmax(szWeaponName));
            
        
client_print(idprint_chat"[%s] Speed Changed Weapon: %s"g_szPrefixNameszWeaponName);


it prints the previous weapon.. If i currently have AK47 Switch to Glock it prints AK47..

and so every one knows its a post hook. Any ideas why it "resets" before the weapon actually changes??

Also would setting a task be a work around? (Ways to check for rapid switching so not to create 200 set tasks lol)

hornet 08-08-2011 22:57

Re: Ham_ResetSpeed
 
Hook CurWeapon instead.

Doc-Holiday 08-08-2011 23:06

Re: Ham_ResetSpeed
 
Quote:

Originally Posted by hornet (Post 1528695)
Hook CurWeapon instead.

lmfao i was just told not to use curweap... also there is a bug

when i zoom in cur weapon... it resets my speed back to normal instead of what the gun is set to.

hornet 08-08-2011 23:11

Re: Ham_ResetSpeed
 
Who told you not to use CurWeapon? What bug?

Well you could hook Ham_Weapon_SecondaryAttack with each weapon that has a zoom function, and set the speed back to what you want?

Exolent[jNr] 08-08-2011 23:28

Re: Ham_ResetSpeed
 
Quote:

Originally Posted by hornet (Post 1528695)
Hook CurWeapon instead.

No, using Ham to reset max speed is the best method.

Doc-Holiday 08-08-2011 23:42

Re: Ham_ResetSpeed
 
Quote:

Originally Posted by Exolent[jNr] (Post 1528701)
No, using Ham to reset max speed is the best method.

Ideas on how to fix the weapon issue??

as of right now i just removed the weapons part so with my snipers the same speed with all his guns.

Arkshine 08-09-2011 03:41

Re: Ham_ResetSpeed
 
ResetMaxSpeed is called when you switch weapon after you deploy it.

get_user_weapon is not updated yet at this time. It updates when CurWeapon message is sent.

So, to get the correct weapon name :

- Retrieve your current active weapon with m_pActiveItem offset : weapon = get_pdata_cbase( id, 373 )
- Get the weapon [CSW] Id with the m_iId offset : weaponId = get_pdata_int( weapon, 43, 4 )
- Then, get_weaponname( weaponId, ... )

Doc-Holiday 08-09-2011 06:02

Re: Ham_ResetSpeed
 
Quote:

Originally Posted by Arkshine (Post 1528748)
ResetMaxSpeed is called when you switch weapon after you deploy it.

get_user_weapon is not updated yet at this time. It updates when CurWeapon message is sent.

So, to get the correct weapon name :

- Retrieve your current active weapon with m_pActiveItem offset : weapon = get_pdata_cbase( id, 373 )
- Get the weapon [CSW] Id with the m_iId offset : weaponId = get_pdata_int( weapon, 43, 4 )
- Then, get_weaponname( weaponId, ... )

THANKS.. will give it a shot

Where do you get these offsets from??

abdul-rehman 08-09-2011 06:24

Re: Ham_ResetSpeed
 
Quote:

Originally Posted by Doc-Holiday (Post 1528801)
THANKS.. will give it a shot

Where do you get these offsets from??

HLDSK i guess.

ConnorMcLeod 08-09-2011 06:37

Re: Ham_ResetSpeed
 
Quote:

Originally Posted by Doc-Holiday (Post 1528801)
Where do you get these offsets from??

Those offsets have been collected/searched from some years so we all have kind of list on our computers :)


All times are GMT -4. The time now is 03:20.

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