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

Striping gun


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
_GamerX
AlliedModders Donor
Join Date: Jun 2011
Location: Fun Server
Old 12-06-2016 , 10:42   Striping gun
Reply With Quote #1

Hi, I using this code for clearing guns from map becouse i want so players could take guns but no guns spam server, but this have one problem if player take dropped gun, timer still active and gun destroyed although he has a player how to solve?

PHP Code:
public void OnEntityCreated(int entity, const char[] classname)
{
    if(!
IsValidEntity(entity)) 
        return;
    if(
StrContains(map"3doors") != -&& StrContains(classname"weapon_") != -1)
    {
        
DispatchKeyValue(entity"OnUser1""!self,Kill,,60.0,-1");
        
AcceptEntityInput(entity"FireUser1");
    }

__________________
_GamerX is offline
Send a message via ICQ to _GamerX Send a message via Skype™ to _GamerX
Mitchell
~lick~
Join Date: Mar 2010
Old 12-06-2016 , 10:46   Re: Striping gun
Reply With Quote #2

That's not how you add outputs, and you should do it when the entity spawns, not when it's created.
Example: https://github.com/MitchDizzle/SMPub...4.sp#L194-L196

Edit: apparently that will work for adding output, the issue was that people can still pick them up, you should either create a timer for each weapon or have a main weapon cleanup timer that checks every weapon on the ground before killing it.
ORRRR
Just do FireUser2 instead of kill and hook the output of the weapon's output OnUser2 then kill it there if the weapon has not been picked up.

Last edited by Mitchell; 12-06-2016 at 12:42.
Mitchell is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 12-06-2016 , 11:53   Re: Striping gun
Reply With Quote #3

So the problem here is that you don't check if the weapon for which the timer callback is triggered is carried by some player?

EDIT: Oh, you don't use timer. You use delayed output.. In that case, why not use SourceMod timer?

P.S.: Also think about what Mitchell said
__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.

Last edited by KissLick; 12-06-2016 at 11:56.
KissLick 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:25.


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