AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Getting pev_iuser* on FM_SetModel (https://forums.alliedmods.net/showthread.php?t=213834)

bibu 04-19-2013 11:56

Getting pev_iuser* on FM_SetModel
 
On deploy of a weapon, I set this on the weapon after some conditions:

PHP Code:

new iWeapon give_item(id"weapon_deagle")

set_pev(iWeaponpev_iuser11

This gets well called and remains always on the weapon. I debugged it already, all fine till here.

But in SetModel, if I drop the weapon, I check it like this:

PHP Code:

if(pev_valid(iEnt) && equal(szModel"models/w_m249.mdl")) 

Also fine, debugged it. But after the next check, it just always returns me false.

PHP Code:

if(pev(iEntpev_iuser1)) 

Somehow, instead of using pev_iuser1, I tried to use pev_owner, and that worked just fine. Has anyone got an idea?

EDIT: btw, If I pick the weapon up, and I hooked the deploy of it, pev_iuser1 returns me 1. :)

Xalus 04-19-2013 12:07

Re: Getting pev_iuser* on FM_SetModel
 
I guess weapons uses iuser integer?

.Dare Devil. 04-19-2013 12:14

Re: Getting pev_iuser* on FM_SetModel
 
pev_fuser is float and pev_iuser int

Bos93 04-19-2013 12:33

Re: Getting pev_iuser* on FM_SetModel
 
if(pev(iEnt, pev_iuser1)) returns zero

Example:

PHP Code:

public FM_Hook_SetModelpEntity, const szModel[ ] )
{
    new 
iId CSW_DEAGLE;
    
    
iId pevpEntitypev_iuser1) )
    
    
client_print0print_chat"%d"iId );



bibu 04-19-2013 12:38

Re: Getting pev_iuser* on FM_SetModel
 
And why only in SetModel it returns 0 and returns 1 in deploy?

Bos93 04-19-2013 12:40

Re: Getting pev_iuser* on FM_SetModel
 
deploy return weapon index

Backstabnoob 04-19-2013 12:41

Re: Getting pev_iuser* on FM_SetModel
 
Isn't it used by something else that resets it to zero?

Arkshine 04-19-2013 16:07

Re: Getting pev_iuser* on FM_SetModel
 
SetModel is called on the weaponbox entity, not the actual weapon entity.

bibu 04-19-2013 16:12

Re: Getting pev_iuser* on FM_SetModel
 
Quote:

Originally Posted by Arkshine (Post 1935984)
not the actual weapon entity.

So how can I get this then? :crab:

Backstabnoob 04-19-2013 16:44

Re: Getting pev_iuser* on FM_SetModel
 
I'd try using these offsets:
Code:
stock const m_rgpPlayerItems_CWeaponBox[6] = { 34 , 35 , ... }


All times are GMT -4. The time now is 02:21.

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