AlliedModders

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

Empowers 07-30-2009 17:55

get_dropped_weapon_bpammo(ent)
 
I have a weapon ent, it is dropped. And I wanna to get it's bpammo.

How can I do such a thing.

Exolent[jNr] 07-30-2009 18:15

Re: get_dropped_weapon_bpammo(ent)
 
http://forums.alliedmods.net/showpos...25&postcount=7

Empowers 07-31-2009 05:56

Re: get_dropped_weapon_bpammo(ent)
 
PHP Code:

#define OFFSET_WBOX_AMMO_BACKPACK_WIN32 73

stock cs_get_weaponbox_bpammo(ent) {
        return 
get_pdata_int(entOFFSET_WBOX_AMMO_BACKPACK_WIN32)


doesn't work on me(( always returns zero

Help me plz

Arkshine 07-31-2009 06:09

Re: get_dropped_weapon_bpammo(ent)
 
Tested on windows or linux ?

xPaw 07-31-2009 07:17

Re: get_dropped_weapon_bpammo(ent)
 
#define cs_get_weaponbox_bpammo(%1) get_pdata_int(%1, OFFSET_WBOX_AMMO_BACKPACK_WIN32, 4)

Empowers 07-31-2009 10:57

Re: get_dropped_weapon_bpammo(ent)
 
Quote:

Originally Posted by Arkshine (Post 886422)
Tested on windows or linux ?

Widnows 32bit system

Quote:

Originally Posted by xPaw (Post 886460)
#define cs_get_weaponbox_bpammo(%1) get_pdata_int(%1, OFFSET_WBOX_AMMO_BACKPACK_WIN32, 4)

this does the same always zero :(

any suggestions?

Arkshine 07-31-2009 11:32

Re: get_dropped_weapon_bpammo(ent)
 
Can you show an example of your code? And yes, the linux extra-offset should be 4.

Empowers 07-31-2009 11:52

Re: get_dropped_weapon_bpammo(ent)
 
Quote:

Originally Posted by Arkshine (Post 886634)
Can you show an example of your code? And yes, the linux extra-offset should be 4.

PHP Code:

#define OFFSET_WBOX_AMMO_BACKPACK_WIN32 73
#define cs_get_weaponbox_bpammo(%1) get_pdata_int(%1, OFFSET_WBOX_AMMO_BACKPACK_WIN32, 4)

public plugin_init()
    
register_forward(FM_SetModel"forward_set_model")


public 
forward_set_model(ent, const model[]) 
{
    if(!
is_weaponbox(ent))
        return 
FMRES_IGNORED;

    for (new 
g_max_clients 1g_max_entities; ++i) {
        if (!
pev_valid(i) || ent != pev(ipev_owner))
            continue
        
        
//both return zero
        
server_print("ent:%i i:%i",cs_get_weaponbox_bpammo(ent),cs_get_weaponbox_bpammo(i))

    
        return 
FMRES_IGNORED
    
}

    return 
FMRES_IGNORED


Code taken from Ven's plugin.

Arkshine 07-31-2009 12:41

Re: get_dropped_weapon_bpammo(ent)
 
cs_get_weaponbox_bpammo(ent) is right but you retrieve when the weaponbox just spawning, I guess it's too early to get the value.

Empowers 08-01-2009 05:01

Re: get_dropped_weapon_bpammo(ent)
 
Quote:

Originally Posted by Arkshine (Post 886692)
cs_get_weaponbox_bpammo(ent) is right but you retrieve when the weaponbox just spawning, I guess it's too early to get the value.

I was trying to set task for 1 second and then retreve value. But the same always returns zero. i think offset is not right. :(


All times are GMT -4. The time now is 18:17.

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