Raised This Month: $51 Target: $400
 12% 

set lastinv


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-05-2009 , 17:28   set lastinv
Reply With Quote #1

Is there any way to set the "lastinv" aka last inventory without sending commands to the player.

I'm playing DOD if that matters.

My motive is that in DOD there is not a preset lastinv when you spawn. You have to select a weapon first to activate lastinv, if you know what I mean.
__________________
fysiks is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 04-05-2009 , 18:07   Re: set lastinv
Reply With Quote #2

I've never used this or played with it, but you can give it a try. I would try get_pdata_cbase first to see what the itemid's are like.

In fact, I'm not sure that these are "settable". I'm a huge noob in cbase stuff.

Code:
#define m_pLastItem 375

set_pdata_cbase( id, m_pLastItem, itemid )
Taken from here: http://wiki.alliedmods.net/CBasePlay...Counter-Strike)

EDIT:
Oh yeah, you're playing DoD. Nevermind, then. I can't help.
__________________

Last edited by stupok; 04-05-2009 at 18:47.
stupok is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 04-05-2009 , 23:19   Re: set lastinv
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
My motive is that in DOD there is not a preset lastinv when you spawn. You have to select a weapon first to activate lastinv, if you know what I mean.
I'm sort of confused here but why can't you send commands to the client?

If you are trying to set the clients lastinv weapon just do something like this when they received their weapons:
PHP Code:
client_cmd(iClient"slot2;lastinv"); // Change slot2 to the number you want as their lastinv. 
If you are trying to remove the clients from using lastinv just block the command until they switch weapons once.

But, if you can do it the way stupok mentioned that would be a lot better (as long as the CBase offsets aren't changing).

Last edited by hlstriker; 04-05-2009 at 23:37.
hlstriker is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-06-2009 , 07:24   Re: set lastinv
Reply With Quote #4

Quote:
Originally Posted by hlstriker View Post
PHP Code:
client_cmd(iClient"slot2;lastinv"); // Change slot2 to the number you want as their lastinv. 
That will only work if hud_fastswitch is turned on (I never have it turned on and we can't assume anything ). Trying to emulate keystrokes is the worst way to do things like this, imo.
__________________
fysiks is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 04-06-2009 , 13:18   Re: set lastinv
Reply With Quote #5

PHP Code:
client_cmd(iClient"slot2;+attack;wait;-attack;lastinv"); 
Only problem with that is if client uses hud_fastswitch 0 they might fire their weapon.

------------

If DoD is like CS you could also try getting the classnames of all the clients weapons after they spawn. Then send a client command of one of the classnames to the player.

How-to for CS:
1) Player spawns.
2) Check all weapons that belong to player.
3) Pick a random weapon the client doesn't have equipped, get it's classname, then send a client command of this classname.

Player x spawns with the following weapon classnames.
- weapon_knife
- weapon_glock18
- weapon_ak47

Player x has weapon_glock18 equipped, so we remove that from the loop.

weapon_ak47 is chosen so we send:
PHP Code:
client_cmd(iClient"%s;wait;lastinv"szClassName); 
hlstriker is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-06-2009 , 13:26   Re: set lastinv
Reply With Quote #6

Have you ever tried to retrieve players offsets on DoD ?
Then you would be able to use stupok method, but with the correct offset.


-edit-

Dod WIN32 offsets

270? - 276? m_rgpPlayerItems[MAX_ITEM_TYPES] // 6 (cbase)
Should be either 271 to 276, either 270 to 275
What is sure is that slot1 is 271, slot2 is 272..

277 - m_pActiveItem (cbase)
278 - m_pClientActiveItem (cbase)
279 - m_pLastItem (cbase)
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-06-2009 at 15:35.
ConnorMcLeod is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 04-06-2009 , 21:34   Re: set lastinv
Reply With Quote #7

Connor, could you briefly explain how you get these offsets? You must have a nice efficient method, and I'm very curious.
__________________
stupok is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-07-2009 , 01:18   Re: set lastinv
Reply With Quote #8

Printing in real time (prethink) in multi-line centered text a range of offsets, range setable by cmd, type (int, float, cbase) setable by cmd to.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 08:30.


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