Raised This Month: $ Target: $400
 0% 

amx_slap


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 02-08-2010 , 18:30   Re: amx_slap
Reply With Quote #4

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
 



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