Raised This Month: $ Target: $400
 0% 

Does anyone have an idea why this lags/causes load?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vamppa
Senior Member
Join Date: Apr 2010
Location: The Netherlands
Old 07-01-2012 , 07:55   Does anyone have an idea why this lags/causes load?
Reply With Quote #1

PHP Code:
#include <amxmodx>

public plugin_init()
{
    
register_plugin("anti one crash ","1.2","Lev")
    
}
public 
client_command(plrid)
{
   
// Get client command.
   
new cmd[5];
   
read_argv(0cmdsizeof(cmd) - 1);
   
// Check if command is drop.
   
if (equali(cmd"drop"))
   {
      
// Get player's weapons count.
      
new num;
      new 
weapons[32];
      
get_user_weapons(plridweaponsnum);
      
// Deny command if user has only 2 weapon
      
if (num == 2)
      {
         return 
PLUGIN_HANDLED;
      }
   }
   return 
PLUGIN_CONTINUE;

wouldn't be better to hook the client drop command?

PHP Code:
#include <amxmodx>

public plugin_init()
{
    
register_plugin("anti one crash ","1.2","Lev")
    
register_clcmd("drop","anticrash")
}
public 
anticrash(plrid)
{
      
// Get player's weapons count.
      
new num;
      new 
weapons[32];
      
get_user_weapons(plridweaponsnum);
      
// Deny command if user has only 2 weapon
      
if (num == 2)
      {
         return 
PLUGIN_HANDLED;
      }
   }
   return 
PLUGIN_CONTINUE;

vamppa is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-01-2012 , 08:06   Re: Does anyone have an idea why this lags/causes load?
Reply With Quote #2

Sure it is better, but what you be even better, is to fix the badly coded plugin that make server crash when you drop a weapon.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
vamppa
Senior Member
Join Date: Apr 2010
Location: The Netherlands
Old 07-18-2012 , 20:28   Re: Does anyone have an idea why this lags/causes load?
Reply With Quote #3

how about this?

PHP Code:
#include <amxmodx> 

public plugin_init() 

    
register_plugin("anti one crash ","1.2","Lev+vamp"
    
register_clcmd("drop","anticrashserver"

public 
anticrashserver(id

      new 
num
      new 
weapons[32]; 
      
get_user_weapons(idweaponsnum); 
      if (
num == 2
      { 
         return 
PLUGIN_HANDLED
      } 
      return 
PLUGIN_CONTINUE;


Last edited by vamppa; 07-18-2012 at 20:35.
vamppa is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-19-2012 , 07:48   Re: Does anyone have an idea why this lags/causes load?
Reply With Quote #4

Quote:
Originally Posted by vamppa View Post
how about this?
Read what Connor said? Fix the bad plugin.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
vamppa
Senior Member
Join Date: Apr 2010
Location: The Netherlands
Old 07-24-2012 , 23:53   Re: Does anyone have an idea why this lags/causes load?
Reply With Quote #5

im trying, one } has been removed as well as plrid to id
i dont know what further is bad about it, since it works for us HLDM.


"fix the badly coded plugin that make server crash when you drop a weapon"
would that crash be cs related?
vamppa is offline
Old 07-31-2012, 17:45
vamppa
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 07-31-2012 , 17:47   Re: Does anyone have an idea why this lags/causes load?
Reply With Quote #6

What are you trying to do??
OvidiuS is offline
Send a message via Skype™ to OvidiuS
vamppa
Senior Member
Join Date: Apr 2010
Location: The Netherlands
Old 07-31-2012 , 17:53   Re: Does anyone have an idea why this lags/causes load?
Reply With Quote #7

making it impossible for players to drop a weapon when they have two (making sure players got at least 2 weapons)
this is to prevent an exploit from happing that can crash the server.

this already does that and works, however I am trying to find the most lag free method.
vamppa is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-31-2012 , 17:56   Re: Does anyone have an idea why this lags/causes load?
Reply With Quote #8

Quote:
Originally Posted by vamppa View Post
this is to prevent an exploit from happing that can crash the server.
That "exploit" is relative to whatever you are running on your server.
It is better to fix the exploit instead of trying to prevent it.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Old 07-31-2012, 18:02
OvidiuS
This message has been deleted by OvidiuS. Reason: listen to exolent and connor :)
vamppa
Senior Member
Join Date: Apr 2010
Location: The Netherlands
Old 08-01-2012 , 08:00   Re: Does anyone have an idea why this lags/causes load?
Reply With Quote #9

I believe this is a known exploit in halflife deathmatch, unfortuantly in our mod "Adrenaline gamer" it didn't get fixed.
for halflife deathmatch valve fixed it by making it so the player has always got to have at least one weapon in his hand.
previously one could drop all his/her weapons.

how the bug prevention is done should be irrelevant, since the question is how to improve this plugin, optimize it?
apparently it is badly coded, ofcourse for the community that is going to use this plugin i want to know.
I tried to figure it out myself but obviously im not good enough and experienced at this.
could you show me how this is properly done?
vamppa is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-01-2012 , 15:33   Re: Does anyone have an idea why this lags/causes load?
Reply With Quote #10

So Adrenaline gamer is a HL mod or a plugin?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 15:01.


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