AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [TS] get_user_weapons() (https://forums.alliedmods.net/showthread.php?t=127182)

Drak 05-17-2010 21:28

[TS] get_user_weapons()
 
I have seen this: http://forums.alliedmods.net/showthread.php?p=400233
But it's not exactly updated to TS 3.0. I tried myself (added the new weapons, changed around the ID's) but the offsets don't seem to work anymore. I'm not even sure how to find them ether. :bacon:

Does anybody know an equivalent to get_user_weapons() - but for TS?

Styles 05-18-2010 17:41

Re: [TS] get_user_weapons()
 
What does it output? And pm me, I might ravamp the TS Module, though TS is completely dead..

Drak 05-19-2010 10:24

Re: [TS] get_user_weapons()
 
Quote:

Originally Posted by Styles (Post 1184401)
What does it output? And pm me, I might ravamp the TS Module, though TS is completely dead..

Just wrong results, I came up with this. I found the offsets by looping through the user's weapon ent pdata, untill it matched the clipped size. That's how ava_ts.inc did it. I tested it, it seemed to work fine. But I didn't try it when the weapons I had, had an empty clip. Ether way, better then nothing. My next problem is, actually stripping the weapons.

Code:

MakeOffsets()
{
        Offsets[1] = 80; // glock 18
        Offsets[2] = -1; // no weapon
        Offsets[3] = 108; // uzi
        Offsets[4] = 122; // shotgun m3
        Offsets[5] = 136; // m4a1
        Offsets[6] = 150; // mp5sd
        Offsets[7] = 164; // mp5k
        Offsets[8] = 94; // bretta
        Offsets[9] = 192; // socom
        Offsets[10] = 206; // akimbo socom
        Offsets[11] = 220; // usas
        Offsets[12] = 234; // degal
        Offsets[13] = 248; // ak47
        Offsets[14] = 262; // 57
        Offsets[15] = 276; // aug
        Offsets[16] = 290; // akimbo uzi
        Offsets[17] = 304; // skorpeon
        Offsets[18] = 318; // barret
        Offsets[19] = 332; // mp7
        Offsets[20] = 346; // spas
        Offsets[21] = 360; // colts
        Offsets[22] = 374; // glock 20
        Offsets[23] = 388; // ump
        Offsets[24] = 624; // m61 grenade
        Offsets[25] = -1; // combat knife
        Offsets[26] = 430; // mossberg
        Offsets[27] = 444; // m16a1
        Offsets[28] = 458; // rugar
        Offsets[29] = -1; // C4
        Offsets[30] = 486; // akimbo 57's
        Offsets[31] = 500; // bull
        Offsets[32] = 514; // m60
        Offsets[33] = 528; // sawed off
        Offsets[34] = -1; // Katana
        Offsets[35] = -1; // Seal Knife
        Offsets[36] = -1; // contender // unknown
        Offsets[37] = 584;
}
ts_get_user_weapons(const id,Weapons[38],&iNum)
{
        new const TSWeapon = ts_get_user_tsgun(id);
       
        if(!TSWeapon)
                return 0
       
        for(new Count;Count < sizeof(Offsets);Count++)
        {
                if(Offsets[Count] <= 0)
                        continue
               
                if(get_pdata_int(TSWeapon,Offsets[Count]) > 0)
                        Weapons[iNum++] = Count
        }
        return 1
}



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

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