AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Perm mute (https://forums.alliedmods.net/showthread.php?t=178418)

naXe 02-15-2012 15:03

Perm mute
 
Welcome.
However, I have a problem. After entering in console perm_mute nick still pops up:
Usage: <nick>

I gave yourself a perm mute, but not enrolled in a file
Can be improved?
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <engine>

new ma_mute[33]
new 
plik_vault


public plugin_init(){
        
plik_vault=nvault_open("mute_list")
        
register_clcmd("perm_mute","dawanie_mute",ADMIN_IMMUNITY,"<nick>")

}
public 
client_connect(id){
        
wczytaj_mute(id)
        if(
ma_mute[id]>0){
        
set_speak(idSPEAK_MUTED)
}
}
public 
client_disconnect(id){
        
zapisz_mute(id)
        
ma_mute[id]=0
}
public 
plugin_end(){
        
nvault_close(plik_vault)
}

public 
dawanie_mute(id,level,cid){
        if(!
cmd_access(id,level,cid,3)) return PLUGIN_HANDLED
        
        
new arg1[32]

        
        
read_argv(1,arg1,31)

        
        new 
player=cmd_target(id,arg1,CMDTARGET_ALLOW_SELF)

        
        if (!
player)
        {
                
console_print(id"Gracz %s nie zostal odnaleziony.",arg1)
                return 
PLUGIN_HANDLED
        
}else
        {

                
ma_mute[id]=1
                set_speak
(idSPEAK_MUTED)

                
client_print(id,print_chat,"*** Zostales wyciszony na zawsze ***"
        }
        return 
PLUGIN_HANDLED
}
public 
wczytaj_mute(id)
{
    new 
name[35]
    
get_user_name(id,name,34)
    new 
vaultkey[64],vaultdata[256]
    
format(vaultkey,63,"%s-mute",name)
    
format(vaultdata,255,"%d#",ma_mute[id])
    
nvault_get(plik_vault,vaultkey,vaultdata,255
 
    
replace_all(vaultdata255"#"" ")
        
    new 
fragitemp[33],deadstemp[33]
    
parse(vaultdata,fragitemp,32,deadstemp,32
     
    return 
PLUGIN_CONTINUE
}  

public 
zapisz_mute(id){
    if(
ma_mute[id] > 0){
    new 
name[35]
    
get_user_name(id,name,34)
    new 
vaultkey[64],vaultdata[256
    
format(vaultkey,63,"%s-mute",name
    
format(vaultdata,255,"%d#",ma_mute[id]) 
    
nvault_set(plik_vault,vaultkey,vaultdata
   }
    return 
PLUGIN_CONTINUE



Exolent[jNr] 02-15-2012 15:04

Re: Perm mute
 
Quote:

Originally Posted by naXe (Post 1651117)
PHP Code:

        if(!cmd_access(id,level,cid,3)) return PLUGIN_HANDLED 


Why did you use 3 there?

naXe 02-15-2012 15:11

Re: Perm mute
 
I do not know xP

I've got to give 2?

Exolent[jNr] 02-15-2012 15:18

Re: Perm mute
 
Don't just guess. What do you think that number represents?


All times are GMT -4. The time now is 09:51.

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