Raised This Month: $ Target: $400
 0% 

amx_slap


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
funstyle
Member
Join Date: Feb 2010
Location: RO, Bucharest
Old 02-08-2010 , 16:27   amx_slap
Reply With Quote #1

how to add a function that can not use amx_slap more than 5 times in a player

PHP Code:
public cmdSlap(idlevelcid)
{
    if (!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED

    
new arg[32]
    
    
read_argv(1arg31)
    new 
player cmd_target(idargCMDTARGET_OBEY_IMMUNITY CMDTARGET_ALLOW_SELF CMDTARGET_ONLY_ALIVE)
    
    if (!
player)
        return 
PLUGIN_HANDLED

    
new spower[32], authid[32], name2[32], authid2[32], name[32]
    
    
read_argv(2spower31)
    
    new 
damage str_to_num(spower)
    
    
user_slap(playerdamage)
    
    
get_user_authid(idauthid31)
    
get_user_name(idname31)
    
get_user_authid(playerauthid231)
    
get_user_name(playername231)
    
    
log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^""nameget_user_userid(id), authiddamagename2get_user_userid(player), authid2)

    
show_activity_key("ADMIN_SLAP_1""ADMIN_SLAP_2"namename2damage);

    
console_print(id"[AMXX] %L"id"CLIENT_SLAPED"name2damage)
    
    return 
PLUGIN_HANDLED

funstyle is offline
Send a message via Yahoo to funstyle
NiQu
Veteran Member
Join Date: Nov 2009
Old 02-08-2010 , 16:37   Re: amx_slap
Reply With Quote #2

I dont know
Maybe you could create ur own slap and make it count each slap.
NiQu is offline
funstyle
Member
Join Date: Feb 2010
Location: RO, Bucharest
Old 02-08-2010 , 16:46   Re: amx_slap
Reply With Quote #3

I need amx_slap order not to let it use more than 5 times to use it on a player
if possible plugin new or little modification of admincmd.amxx

Last edited by funstyle; 02-08-2010 at 16:49.
funstyle is offline
Send a message via Yahoo to funstyle
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 02-08-2010 , 17:53   Re: amx_slap
Reply With Quote #4

Quote:
Originally Posted by NiQu View Post
I dont know
Maybe you could create ur own slap and make it count each slap.
Why post if you don't know.
__________________
Hi.
Kreation is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 02-08-2010 , 18:30   Re: amx_slap
Reply With Quote #5

Quote:
Originally Posted by Kreation View Post
Why post if you don't know.
The same goes for you.

@funstyle: You need to make few small changes:
PHP Code:
#define MAX_SLAPS 5
new g_slap_cnt[33]
public 
cmdSlap(idlevelcid)
{
    if (!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED

    
new arg[32]
    
    
read_argv(1arg31)
    new 
player cmd_target(idargCMDTARGET_OBEY_IMMUNITY CMDTARGET_ALLOW_SELF CMDTARGET_ONLY_ALIVE)
    
    if (!
player || ++g_slap_cnt[player] > MAX_SLAPS)
        return 
PLUGIN_HANDLED

    
new spower[32], authid[32], name2[32], authid2[32], name[32]

    
read_argv(2spower31)

    new 
damage str_to_num(spower)
    
user_slap(playerdamage)
    
    
get_user_authid(idauthid31)
    
get_user_name(idname31)
    
get_user_authid(playerauthid231)
    
get_user_name(playername231)
    
    
log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^""nameget_user_userid(id), authiddamagename2get_user_userid(player), authid2)

    
show_activity_key("ADMIN_SLAP_1""ADMIN_SLAP_2"namename2damage);

    
console_print(id"[AMXX] %L"id"CLIENT_SLAPED"name2damage)
    
    return 
PLUGIN_HANDLED

But you also need to reset g_slap_cnt[id] somewhere.

You can do this (you will be able to slap player only 5 times until he disconnects):
PHP Code:
public client_connect(id)
    
g_slap_cnt[id] = 
or this (you will be able to slap player 5 times after every spawn):
PHP Code:
#include <hamsandwich>
public plugin_init(){
    
RegisterHam(Ham_Spawn"player""player_spawn"1)
}

public 
player_spawn(id){
    if(!
is_user_alive(id))
        return
    
g_slap_cnt[id] = 0

__________________
Impossible is Nothing
Sylwester is offline
funstyle
Member
Join Date: Feb 2010
Location: RO, Bucharest
Old 02-08-2010 , 19:28   Re: amx_slap
Reply With Quote #6

wow, thank you very much Sylwester work ,i add that the you will be able to slap player 5 times after every spawn

can you after 5 slapping if you try to give more a msg appear

Last edited by funstyle; 02-08-2010 at 19:32.
funstyle is offline
Send a message via Yahoo to funstyle
-B1ng0-
Member
Join Date: Nov 2009
Old 07-06-2010 , 03:21   Re: amx_slap
Reply With Quote #7

Try this
PHP Code:
#define MAX_SLAPS 5
new g_slap_cnt[33]
public 
cmdSlap(idlevelcid)
{
    if (!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED

    
new arg[32]
    
    
read_argv(1arg31)
    new 
player cmd_target(idargCMDTARGET_OBEY_IMMUNITY CMDTARGET_ALLOW_SELF CMDTARGET_ONLY_ALIVE)
    
    if (!
player || ++g_slap_cnt[player] > MAX_SLAPS){
        
client_print(idprint_chat"* You can do this only 5 times a player in each round")
        return 
PLUGIN_HANDLED
    
}

    new 
spower[32], authid[32], name2[32], authid2[32], name[32]

    
read_argv(2spower31)

    new 
damage str_to_num(spower)
    
user_slap(playerdamage)
    
    
get_user_authid(idauthid31)
    
get_user_name(idname31)
    
get_user_authid(playerauthid231)
    
get_user_name(playername231)
    
    
log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^""nameget_user_userid(id), authiddamagename2get_user_userid(player), authid2)

    
show_activity_key("ADMIN_SLAP_1""ADMIN_SLAP_2"namename2damage);

    
console_print(id"[AMXX] %L"id"CLIENT_SLAPED"name2damage)
    
    return 
PLUGIN_HANDLED

Changes:
PHP Code:
if (!player || ++g_slap_cnt[player] > MAX_SLAPS)
        return 
PLUGIN_HANDLED 
with this:
PHP Code:
if (!player || ++g_slap_cnt[player] > MAX_SLAPS){
        
client_print(idprint_chat"* You can do this only 5 times a player in each round")
        return 
PLUGIN_HANDLED
    


Last edited by -B1ng0-; 07-06-2010 at 04:47.
-B1ng0- 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 07:18.


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