Raised This Month: $ Target: $400
 0% 

register "lastinv" command doesn't work


Post New Thread Reply   
 
Thread Tools Display Modes
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 08-24-2009 , 10:40   Re: register "lastinv" command doesn't work
Reply With Quote #11

Thx for the info hleV.

Maybe that i want to do can be made without hooking the lastinv command.

Someone can explain to me about this?

http://forums.alliedmods.net/showpos...07&postcount=7

PHP Code:
new ent get_pdata_cbase(id375//registering the "lastinv" (ent)
if (pev_valid(ent) && get_pdata_int(ent43) == CSW_KNIFE// if the lastinv is valid and the weapon in the lastinv is the KNIFE 
        
engclient_cmd(id"lastinv")// execute "lastinv" command from the player 
I am right in the comments?

And where should i use this?
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 08-24-2009 , 13:26   Re: register "lastinv" command doesn't work
Reply With Quote #12

@Alu: is the offset for get the weapon ent, and then the num, like: get_user_weapon();
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 08-24-2009 , 13:28   Re: register "lastinv" command doesn't work
Reply With Quote #13

You can try CurWeapon.
__________________
hleV is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-24-2009 , 14:25   Re: register "lastinv" command doesn't work
Reply With Quote #14

Yes, i thought at that, you can get last weapon and current one, then when you switch to last one can be a "lastinv" but you can switch it with slot1,2 and wouldn't be "lastinv".
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-24-2009 , 15:10   Re: register "lastinv" command doesn't work
Reply With Quote #15

What do you exactly want to do ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-24-2009 , 16:34   Re: register "lastinv" command doesn't work
Reply With Quote #16

Quote:
Originally Posted by ConnorMcLeod View Post
What do you exactly want to do ?
He want to know when "lastinv" command was executed...
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-24-2009 , 16:40   Re: register "lastinv" command doesn't work
Reply With Quote #17

He may want to prevent it from being executed ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 08-24-2009 , 17:05   Re: register "lastinv" command doesn't work
Reply With Quote #18

@ConnorMcLeod

"Something" like that... but not at all...

Well, this thread started like a "need help" to do a plugin with my hands but now the thread changed to something like a "Suggestion idea for good coders" (or for ppl who can do this =p)

Becouse i tried with a lot of methods but failed. So here is the idea of the plugin.

Is a bug fix... For example: When you respawn with a usp (active)... if you switch to knife, then go back to usp... drop the usp... (automatic get switch to knife) when you pres Q (lastinv) show animation like a switch weapon but dont change the weapon (becouse you dont have that weapon, is droped). So you can press Q all the time and you see the animation of switching but u always have knife.

This try of bugfix is to prevent that bug (isn't rly annoying yes but still is a bug fix 8D)

Don't get it like a request, i dont wanna to use this bugfix becouse is not annoying for me but some ppl maybe want it. And if someone can do it, i will learn what i did it wrong =p

Here is my last stupid try:

PHP Code:
#define m_pLastItem 375

public plugin_init()
{     
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("CurWeapon""HookCurWeapon""b")
}

public 
HookCurWeapon(id)
{
    static 
ent
    
if (get_pdata_cbase(ent375) != pev_valid(ent) )
        return 
HAM_IGNORED

And here is my first try of this bugfix... this """"""work"""""" but yeah, the method sucks and have some bugs:

PHP Code:
#define OFFSET_PRIMARYWEAPON 116 

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("drop""HookDrop")
}

public 
HookDrop(id)
{
    new 
Weapons[32], Wnames[32], Numi
    get_user_weapons
(idWeaponsNum)
    
    
strip_user_weapons(id)
    
set_pdata_int(idOFFSET_PRIMARYWEAPON0
    
    for(
i=0i<Numi++)
    {
        
get_weaponname(Weapons[i], Wnames31)
        
give_item(idWnames)
    } 

P.S: Sry if my english is not very good and sry if the example of the bugfix is not understandable (maybe i can do a demo if dont understand).
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...

Last edited by Alucard^; 08-24-2009 at 17:07.
Alucard^ is offline
Send a message via Skype™ to Alucard^
stupok
Veteran Member
Join Date: Feb 2006
Old 08-24-2009 , 19:21   Re: register "lastinv" command doesn't work
Reply With Quote #19

Quote:
Originally Posted by Alucard^ View Post
PHP Code:
public plugin_init()   
    
register_clcmd("lastinv""HookLastInv")

public 
HookLastInv(id)
    
client_print(idprint_chat"I'am a debug message. And I dont work :("
Why this doesn't work? this is not the correct method to detect the "lastinv" command?
you didn't register the plugin

@ EVERYONE

You're all wrong. You might want to double-check your claims next time... <_<

Tested and works:
PHP Code:
#include <amxmodx>

public plugin_init()
{
    
register_plugin"lastinv""1.0""stupok" )
    
register_clcmd"lastinv""command_LastInv" )
}

public 
command_LastInvid )
{
    
client_printidprint_chat"* You pressed lastinv!" )

__________________
stupok is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-24-2009 , 20:32   Re: register "lastinv" command doesn't work
Reply With Quote #20

Quote:
Originally Posted by stupok View Post
you didn't register the plugin
You don't need to register the plugin with register_plugin().
__________________
fysiks 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 19:00.


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