Raised This Month: $ Target: $400
 0% 

Holyslap fix (slaps another user, if previous got banned).


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hammerfallerz
Senior Member
Join Date: Feb 2008
Old 07-29-2009 , 02:02   Holyslap fix (slaps another user, if previous got banned).
Reply With Quote #1

As a topic says, can anyone fix this plugin?
http://forums.alliedmods.net/showthread.php?t=4478

Before that it on our server months ago, I've edited plugin and made it slap 5k times.

Yesterday on our zombie plague one dude started to block zombies to get to the humans and I've used holyslap on him. He said everything he thinks about me, what leaded for his temp. ban.
And I've noticed that he left, another player started to get holyslaped. Why? :O

Can anyone find a reason for it and fix it?
Hammerfallerz is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-29-2009 , 02:39   Re: Holyslap fix (slaps another user, if previous got banned).
Reply With Quote #2

I would try and help you but I won't touch a .rar file .
__________________
fysiks is offline
Hammerfallerz
Senior Member
Join Date: Feb 2008
Old 07-29-2009 , 03:19   Re: Holyslap fix (slaps another user, if previous got banned).
Reply With Quote #3

PHP Code:
/* AMXMODX script.
* (c) Copyright 2004, TaL
* This file is provided as is (no warranties).
*
* AMX Holy Slap Plugin
*
* Slaps user 100 times 1HP at a time, then plays
* the attached sound as they fall out of the air
*
*
* usage: amx_holyslap authid, nick, or #userid
*
* Thanks to BarMan origonal Code
*
*/

#include <amxmodx>
#include <amxmisc>
#include <fun>

public admin_slap(id,level,cid){
   if (!
cmd_access(id,level,cid,2))
   return 
PLUGIN_HANDLED

   
new name[32]
   new 
arg[32]
   
read_argv(1,arg,31)
   new 
player cmd_target(id,arg,5)
   if (!
player)
   return 
PLUGIN_HANDLED

   
new ids[2]
   
ids[0] = player
   get_user_name
(player,name,32)
   
disarm_player(id,player)
   
set_task(0.1"slap_player"0ids1"a"100)
   
set_task(11.5"last_words"0ids1"a"0)
   return 
PLUGIN_HANDLED
}

public 
disarm_player(id,victim){
   new 
name[32], origin[3]
   
get_user_origin(victim,origin)
   
origin[2] -= 2000
   set_user_origin
(victim,origin)
   new 
iweapons[32], wpname[32], inum
   get_user_weapons
(victim,iweapons,inum)
   for(new 
a=0;a<inum;++a){
      
get_weaponname(iweapons[a],wpname,31)
      
engclient_cmd(victim,"drop",wpname)
   }
   
engclient_cmd(victim,"weapon_knife")
   
origin[2] += 2005
   set_user_origin
(victim,origin)
   
get_user_name(victim,name,31)
   return 
PLUGIN_CONTINUE
}

public 
last_words(ids[]) {
   
client_cmd(0,"spk misc/knockedout")
   return 
PLUGIN_HANDLED
}

public 
slap_player(ids[]) {
   new 
id ids[0]
   new 
power1 1,nopower0
   
if (get_user_health(id) > 1){
      
user_slap(id,power1)
   } else {
      
user_slap(id,nopower)
   }
   return 
PLUGIN_CONTINUE
}

public 
plugin_init(){
   
register_plugin("AMXMODX Holy Slap","0.1.0","Ms-Proxy")
   
register_concmd("amx_holyslap","admin_slap",ADMIN_SLAY,"<authid, nick or #userid>")
   return 
PLUGIN_CONTINUE

This is original sourcecode. In a modded one I've deleted only this dumb sound.

Like:
PHP Code:
//    set_task(11.5, "last_words", 0, ids, 1, "a", 0) 
PHP Code:
/* public last_words(ids[]) {
   client_cmd(0,"spk misc/knockedout")
   return PLUGIN_HANDLED
} */ 
Hammerfallerz is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-29-2009 , 03:31   Re: Holyslap fix (slaps another user, if previous got banned).
Reply With Quote #4

Wow, are you sure that was the original source code? It's horrible (IMO), surprised that it was approved like that.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>

public plugin_init()
{
    
register_plugin("AMXMODX Holy Slap","0.1.0","Ms-Proxy")
    
register_concmd("amx_holyslap","admin_slap",ADMIN_SLAY,"<authid, nick or #userid>")
}  

public 
client_connect(id)
{
    
remove_task(id)
}

public 
admin_slap(id,level,cid)
{
    if (!
cmd_access(id,level,cid,2))
        return 
PLUGIN_HANDLED

    
new arg[32]
    
read_argv(1,arg,31)
    new 
player cmd_target(id,arg,5)
    
    if(
player)
    {
        
disarm_player(id,player)
        
set_task(0.1"slap_player"id__"a"100)
    }
    return 
PLUGIN_HANDLED
}

public 
disarm_player(id,victim)
{
    new 
origin[3]
    
get_user_origin(victim,origin)
    
origin[2] -= 2000
    set_user_origin
(victim,origin)
    new 
iweapons[32], wpname[32], inum
    get_user_weapons
(victim,iweapons,inum)
    
    for(new 
a=0;a<inum;++a)
    {
        
get_weaponname(iweapons[a],wpname,31)
        
engclient_cmd(victim,"drop",wpname)
    }
    
    
engclient_cmd(victim,"weapon_knife")
    
origin[2] += 2005
    set_user_origin
(victim,origin)
}

public 
slap_player(id)
{
    if(
get_user_health(id) > 1)
    {
        
user_slap(id1)
    }
    else
    {
        
user_slap(id0)
    }

Updated, again . Had to get rid of some warnings.
__________________

Last edited by fysiks; 07-29-2009 at 03:44.
fysiks is offline
Hammerfallerz
Senior Member
Join Date: Feb 2008
Old 07-29-2009 , 03:32   Re: Holyslap fix (slaps another user, if previous got banned).
Reply With Quote #5

Um yea, one small notice: original file comes as an *.amx, but months ago I compiled it with AMXX Studio 1.8.1, so it has *.amxx right now, however, backwards compability (or whatever it's spelled) is enabled on our server, because we use one very old, but stable amx plugin.

Update: w00t, you're faster then me :O
I'll try, thanks again!
Hammerfallerz is offline
Hammerfallerz
Senior Member
Join Date: Feb 2008
Old 07-29-2009 , 03:35   Re: Holyslap fix (slaps another user, if previous got banned).
Reply With Quote #6

And yeah, one small question: original plugin continues to slap punished user if he reconnects. Will modded one work like that also?

I can see:
PHP Code:
public client_connect(id

    
remove_task(id

This is fix, I understand, but how to make it to continue punishment to the user if he reconnects?

About crappy code: well, plugin's dated 2004 year

Last edited by Hammerfallerz; 07-29-2009 at 03:40.
Hammerfallerz is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-29-2009 , 03:41   Re: Holyslap fix (slaps another user, if previous got banned).
Reply With Quote #7

Updated my code.

Quote:
Originally Posted by Hammerfallerz View Post
And yeah, one small question: original plugin continues to slap punished user if he reconnects. Will modded one work like that also?
Actually, that is what you wanted fix lol .
__________________
fysiks is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-29-2009 , 03:44   Re: Holyslap fix (slaps another user, if previous got banned).
Reply With Quote #8

Updated again to get rid of warnings.
__________________
fysiks is offline
Hammerfallerz
Senior Member
Join Date: Feb 2008
Old 07-29-2009 , 03:44   Re: Holyslap fix (slaps another user, if previous got banned).
Reply With Quote #9

No, you didnt understood.

Player "A" blocked and get holyslaped. He started to insult admins for it, so he received a ban. He got disconnected and some random B player started to get holyslaped as soon as A player left.
But when connected C client, B client stopped to get holyslaped and holyslap skipped to client C.

I only want if player "A" gets holyslapped and he reconnects -> continue punishment.
If "A" player leaves and does not connects, but connects some C player, plugin wont touch him, he didnt do anything to punish him.

Is this fixed? Will that happen?
Hammerfallerz is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-29-2009 , 03:52   Re: Holyslap fix (slaps another user, if previous got banned).
Reply With Quote #10

Quote:
Originally Posted by Hammerfallerz View Post
He got disconnected and some random B player started to get holyslaped as soon as A player left.
I don't see how this is possible with this code.

Quote:
Originally Posted by Hammerfallerz View Post
But when connected C client, B client stopped to get holyslaped and holyslap skipped to client C.
This is what I fixed. This is also what makes you think that the punishment was resumed when kicked player rejoined. (It's just a fluke)

So, making it so that the kicked player resumes his punishment (correctly) is much much more involved.

So, basically, I understand what you want. But what you want never existed before, it just happened to work that way once.
__________________

Last edited by fysiks; 07-29-2009 at 03:55.
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:29.


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