Raised This Month: $ Target: $400
 0% 

[H3LP] Weapon Respawn Time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DarthMan
Veteran Member
Join Date: Aug 2011
Old 04-20-2017 , 13:08   [H3LP] Weapon Respawn Time
Reply With Quote #1

Hello everyone. How can I set the time be4 a weapon respawns?
I've been trying everything, but nothing seems to work.
Thanks !
DarthMan is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 04-20-2017 , 13:17   Re: [H3LP] Weapon Respawn Time
Reply With Quote #2

pev_nextthink or Ham_Respawn() seem to be related to Item Respawning, unfortunately I haven't work with them too much, but you can test them.
__________________

Last edited by gabuch2; 04-20-2017 at 13:18.
gabuch2 is offline
PartialCloning
Senior Member
Join Date: Dec 2015
Old 04-20-2017 , 13:31   Re: [H3LP] Weapon Respawn Time
Reply With Quote #3

By weapon you mean armoury entities? Call ExecuteHam(Ham_CS_Restart, Entity) on the entity. Alternatively you can change its flags to ~EF_NODRAW and the m_iCount to m_iInitialCount or the amount you would want it to have.
PartialCloning is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 04-20-2017 , 13:32   Re: [H3LP] Weapon Respawn Time
Reply With Quote #4

Quote:
Originally Posted by PartialCloning View Post
By weapon you mean armoury entities? Call ExecuteHam(Ham_CS_Restart, Entity) on the entity. Alternatively you can change its flags to ~EF_NODRAW and the m_iCount to m_iInitialCount or the amount you would want it to have.
Nope, I want for my HL1 server to check on any weapon respawn.
DarthMan is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 04-20-2017 , 13:58   Re: [H3LP] Weapon Respawn Time
Reply With Quote #5

Quote:
Originally Posted by PartialCloning View Post
By weapon you mean armoury entities?
Weapon entities mean weapon entities. (weapon_*)
__________________
gabuch2 is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 04-20-2017 , 14:11   Re: [H3LP] Weapon Respawn Time
Reply With Quote #6

Quote:
Originally Posted by Gabe Iggy View Post
Weapon entities mean weapon entities. (weapon_*)
Ik, maybe with an enumeration it will check for all?
DarthMan is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 04-20-2017 , 14:21   Re: [H3LP] Weapon Respawn Time
Reply With Quote #7

Quote:
Originally Posted by DarthMan View Post
Ik, maybe with an enumeration it will check for all?
Just try with the stuff I recommended you, unless the game you want to mod is CS you won't get more help than this.

(Assuming the weapon is grabbed and not respawned)
PHP Code:
set_pev(idpev_nextthinkget_gametime()+n
n being the delay to respawn


Another more reliable way is to hook Ham_Respawn like I told you, then set a timer to execute
PHP Code:
ExecuteHamB(Ham_Respawnid
Like I said I haven't tested them too much, so your best bet is to test them and experiment yourself.
__________________

Last edited by gabuch2; 04-20-2017 at 14:23.
gabuch2 is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 04-21-2017 , 09:21   Re: [H3LP] Weapon Respawn Time
Reply With Quote #8

Quote:
Originally Posted by Gabe Iggy View Post
Just try with the stuff I recommended you, unless the game you want to mod is CS you won't get more help than this.

(Assuming the weapon is grabbed and not respawned)
PHP Code:
set_pev(idpev_nextthinkget_gametime()+n
n being the delay to respawn


Another more reliable way is to hook Ham_Respawn like I told you, then set a timer to execute
PHP Code:
ExecuteHamB(Ham_Respawnid
Like I said I haven't tested them too much, so your best bet is to test them and experiment yourself.
I have tried ur suggestion, on spawn, respawn and also think, it didn't work on any of these cases sadly.
Maybe u can show me a complete example of how it's done in CS then I can update it to work with HL and GC?

Last edited by DarthMan; 04-21-2017 at 09:32.
DarthMan is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 04-20-2017 , 14:14   Re: [H3LP] Weapon Respawn Time
Reply With Quote #9

He mean to call when the weapons from the ground ( example fy_snow weapons ) are being created.

Example, when a new WEAPONBOX entity are maded.

This will be scanned ONLY when you pickup an m4a1, that's when you first create a m4a1 weaponbox:

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

public plugin_init( )
{
    
RegisterHamHam_Spawn "weapon_m4a1""Test" );
}

public 
TestEnt )
{
    if( !
pev_validEnt ) )
        return 
PLUGIN_HANDLED;

    new 
szClass15 ];
    
pevEnt pev_classnameszClasscharsmaxszClass ) );

    
server_print"%s "szClass );
    return 
PLUGIN_CONTINUE;

__________________
Project: Among Us

Last edited by Craxor; 04-20-2017 at 14:16.
Craxor is offline
Send a message via ICQ to Craxor
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 04-21-2017 , 09:50   Re: [H3LP] Weapon Respawn Time
Reply With Quote #10

Post the code to see how are you trying.

EDIT: Try this:

PHP Code:
/* Mod Template generated by Pawn Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

#define PLUGIN    "New Plugin"
#define VERSION    "1.0"
#define AUTHOR    "Unknown"

/* Initialization */

#define RESPAWN_TIME 5.0
#define RESPAWN_ID 48575

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
RegisterHam(Ham_Respawn"weapon_shotgun""respawn_hook");
    
RegisterHam(Ham_Touch"weapon_shotgun""touch_hook"1); //post
}

public 
touch_hook(idother)
{
    
//weapon is picked up, assumed it dissapeared from the world
    //we set a task to respawn it
    
set_task(RESPAWN_TIME"respawn_task"RESPAWN_ID+id);
}

public 
respawn_hook(id)
{
    
// prevent natural respawn
    
return HAM_SUPERCEDE;
}

public 
respawn_task(tid)
{
    new 
id tid RESPAWN_ID;
    
ExecuteHam(Ham_Respawnid);

Untested. Done extremely quick.
__________________

Last edited by gabuch2; 04-21-2017 at 10:00. Reason: changed 9mmar to shotgun because 9mmar may be case sensitive
gabuch2 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 18:00.


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