Raised This Month: $32 Target: $400
 8% 

Grenade Spam Punish


Post New Thread Reply   
 
Thread Tools Display Modes
-=STN=- MaGe
Veteran Member
Join Date: Apr 2004
Location: Asault World
Old 07-05-2006 , 12:41   Re: Grenade Spam Punish
Reply With Quote #21

okay used this plugin since you made it, but today i upgraded to 1.75a and redownloaded the plugin.

everytime anyone throws a nade they get this
Code:
"MuLLen * (RADIO): Fire in the hole!
You have exceeded the maximum number of HE Grenades that you can throw.
You are only allowed 0 HE Grenades per round."
my config files is below
Code:
mp_grenspampunish 1 // enable/disable plugin mp_grenspampunish_maxflash 2 // number of FB's allowed per round mp_grenspampunish_maxhe 1 // number of HE's allowed per round mp_grenspampunish_maxsmoke 1 // number of SG's allowed per round mp_grenspampunish_damage 99 // Slap them for x damage

using
Code:
Grenade Spam Punish  1.1      [gOf]-Soul        grenspampunish.amxx  debug
[EDIT]
Tried it again with my old version and it works fine.
Code:
Grenade Spam Punish  1.0      [gOf]-Soul        grenspampunish.amxx  running
In case anyone else has this problem here is the old version.
Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <csx> #include <cstrike> #define PLUGIN "Grenade Spam Punish" #define VERSION "1.0" #define AUTHOR "[gOf]-Soul" new grencount[33] public plugin_init(){   register_plugin(PLUGIN  , VERSION , AUTHOR )   register_event("ResetHUD", "funcNewRound", "b")   register_cvar("mp_grenspampunish",          "1"  )    // enable/disable plugin   register_cvar("mp_grenspampunish_maxflash", "2"  )    // number of FB's allowed per round   register_cvar("mp_grenspampunish_maxhe",    "1"  )    // number of HE's allowed per round   register_cvar("mp_grenspampunish_maxsmoke", "0"  )    // number of SG's allowed per round   register_cvar("mp_grenspampunish_damage",   "99")    // health to remove upon punishment   new szConfigFile[64]   get_configsdir( szConfigFile, 63 )   format( szConfigFile, 63, "%s/grenspampunish.cfg", szConfigFile )   server_cmd( "exec %s", szConfigFile ) } public funcNewRound(id) {   if ( !get_cvar_num("mp_grenspampunish") )     return PLUGIN_CONTINUE   set_task(1.0, "funcResetStats", id)   return PLUGIN_CONTINUE } public funcResetStats(id){   //Get Auth ID   new authid[32]   new vaultkey[64],vaultdata[64]   get_user_authid(id,authid,31)   //reset he grenades   format(vaultkey,63,"%s-%s", "HE Grenades", authid)   format(vaultdata,63,"%d",0)   set_vaultdata(vaultkey,vaultdata)   //reset smoke grenades   format(vaultkey,63,"%s-%s", "Smoke Grenades", authid)   format(vaultdata,63,"%d",0)   set_vaultdata(vaultkey,vaultdata)   //reset flash grenades   format(vaultkey,63,"%s-%s", "Flash Grenades", authid)   format(vaultdata,63,"%d",0)   set_vaultdata(vaultkey,vaultdata)   return PLUGIN_CONTINUE } public grenade_throw( index , greindex , wId ){   //Get Auth ID   new authid[32]   new playername[32]   new vaultkey[64],vaultdata[64]   get_user_authid(index ,authid,31)   get_user_name(index, playername, 31)   new punishlevel   new greName[32]   if ( wId==CSW_HEGRENADE ){     copy(greName,31,"HE Grenades")     punishlevel = get_cvar_num("mp_grenspampunish_maxhe")   }   else if ( wId==CSW_SMOKEGRENADE ){     copy(greName,31,"Smoke Grenades")     punishlevel = get_cvar_num("mp_grenspampunish_maxsmoke")   }   else if ( wId==CSW_FLASHBANG ){     copy(greName,31,"Flash Grenades")     punishlevel = get_cvar_num("mp_grenspampunish_maxflash")   }   //get grenade count   format(vaultkey,63,"%s-%s", greName, authid)   get_vaultdata(vaultkey,vaultdata,63)   grencount[index]=str_to_num(vaultdata)   grencount[index]=grencount[index]+1   //set grenade count   format(vaultkey,63,"%s-%s", greName, authid)   format(vaultdata,63,"%d",grencount[index])   set_vaultdata(vaultkey,vaultdata)   if (punishlevel < grencount[index]){     client_print(index ,print_chat,"You have exceeded the maximum number of %s that you can throw.",greName)     client_print(index ,print_chat,"You are only allowed %d %s per round.",punishlevel,greName)     user_slap(index, get_cvar_num("mp_grenspampunish_damage"))     remove_entity(greindex)     set_hudmessage(255 ,0 ,0 ,-1.0 ,0.32 ,0 ,6.0 ,10.0 )     show_hudmessage(0," %s was slayed because they were grenade spamming", playername)   } }
__________________




Last edited by -=STN=- MaGe; 07-05-2006 at 13:07.
-=STN=- MaGe is offline
Send a message via Yahoo to -=STN=- MaGe
Psyfire
Senior Member
Join Date: Jan 2006
Old 07-17-2006 , 09:17   Re: Grenade Spam Punish
Reply With Quote #22

Like mage said, the newer Version doesnt work correct. I have the same problem but I set the 3 cvars for my map and so it worked good

Edit: It crashs the server :/

Last edited by Psyfire; 07-17-2006 at 11:19.
Psyfire is offline
DaSoul
Senior Member
Join Date: Jan 2006
Old 07-25-2006 , 08:50   Re: Grenade Spam Punish
Reply With Quote #23

Sorry I will post a new version. Very very soon. Glad to see people actually using it. I made some quick hack changes to get it working again. But its not clean. I will work on cleaning it up a bit tonight.

EDIT: I will have to get a 1.75 environment up to test it on. Should be able to get it done tonight though.
DaSoul is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 07-25-2006 , 09:15   Re: Grenade Spam Punish
Reply With Quote #24

dunno why this was just sitting in the new section.
I like the customization.

Only thing that I would like to see done to it is use pcvar's over cvars.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
DaSoul
Senior Member
Join Date: Jan 2006
Old 07-25-2006 , 09:16   Re: Grenade Spam Punish
Reply With Quote #25

Quote:
Originally Posted by Suicid3
dunno why this was just sitting in the new section.
I like the customization.

Only thing that I would like to see done to it is use pcvar's over cvars.
What is the pcvar? I will go check it out.

EDIT: I found them

EDIT: Added a beta version. I am unable to test it here at work though. So I don't even know if it will load or if I did the map specific configs correctly. I will test and update the post tonight with a fully tested version. But this should allow someone to actually use it on 1.70 and above.

cvars go into the amxx.cfg or into map specific config files.

Last edited by DaSoul; 07-25-2006 at 09:42.
DaSoul is offline
slurpycof
Senior Member
Join Date: Nov 2004
Old 07-25-2006 , 15:42   Re: Grenade Spam Punish
Reply With Quote #26

Great plugin, hope your fixes work. +karma
slurpycof is offline
DaSoul
Senior Member
Join Date: Jan 2006
Old 07-25-2006 , 18:00   Re: Grenade Spam Punish
Reply With Quote #27

I think I just fixed it. I tested it. There were some bugs in that beta. But this version I am uploading now will fix it. I think I also fixed the "punished for first nade bug" that we had seen happen on our servers.
DaSoul is offline
-=STN=- MaGe
Veteran Member
Join Date: Apr 2004
Location: Asault World
Old 08-06-2006 , 12:47   Re: Grenade Spam Punish
Reply With Quote #28

still slays for me
__________________



-=STN=- MaGe is offline
Send a message via Yahoo to -=STN=- MaGe
DaSoul
Senior Member
Join Date: Jan 2006
Old 08-07-2006 , 16:06   Re: Grenade Spam Punish
Reply With Quote #29

Im using this fine on our servers... do you have the proper cvars in your amxx.cfg file? Also is your "log on"? Because thats how it resets the grenade throw count.
__________________

Last edited by DaSoul; 08-07-2006 at 16:09.
DaSoul is offline
vittu
SuperHero Moderator
Join Date: Oct 2004
Location: L.A. County, CA
Old 08-12-2006 , 07:30   Re: Grenade Spam Punish
Reply With Quote #30

Couple of things,

What broke your plugin was:
  • You removed the csx include which is needed for the grenade_throw forward. You're not even using cstike so you can remove the need to include it.
  • When you changed from the ResetHUD event to using the Round_Start logevent. Round start doesn't pass an id. So the nade counts never get reset to 0 for any of the clients. (resethud was fine, doesn't even really need the delay)
    Code:
    register_logevent("funcNewRound", 2, "1=Round_Start") public funcNewRound(id) {

This should not be in the code, those will be run by amxmodx itself at the appropriate times (then you can remove the need to include amxmisc):
Code:
  new configsdir[128]   get_configsdir(configsdir, 127)   server_cmd("exec %s/amxx.cfg", configsdir)     new currmap[128]   get_mapname(currmap,127)   server_cmd("exec %s/maps/%s.cfg",configsdir, currmap)

When using pcvars you don't need to set them to global varibles like below. That is almost basically what you are already doing by using pcvars.
Code:
  limitFlash = get_pcvar_num(p_grenspampunish_maxflash)   limitHE = get_pcvar_num(p_grenspampunish_maxhe)   limitSmoke = get_pcvar_num(p_grenspampunish_maxsmoke)

And it would be better to use a switch statement for this instead:
Code:
  if ( wId==CSW_HEGRENADE ){     copy(greName,31,"HE Grenades")     punishlevel = limitHE     grencountindex = 0   }   else if ( wId==CSW_SMOKEGRENADE ){     copy(greName,31,"Smoke Grenades")     punishlevel = limitSmoke     grencountindex = 1   }   else if ( wId==CSW_FLASHBANG ){     copy(greName,31,"Flash Grenades")     punishlevel = limitFlash     grencountindex = 2   }

Also, you don't have enough parameters for your set_hudmessage:
Code:
set_hudmessage(255 ,0 ,0 ,-1.0 ,0.32 ,0 ,6.0 ,10.0 )



I'm gonna try using this with the fixes until Brad fixes the issues with the Grenade Control plugin and rebuy.
vittu is offline
Send a message via AIM to vittu Send a message via MSN to vittu Send a message via Yahoo to vittu
Reply


Thread Tools
Display Modes

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 10:49.


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