Raised This Month: $51 Target: $400
 12% 

add one msg for cmdban


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bakir123
Senior Member
Join Date: Jan 2015
Location: Palestine, Hebron
Old 09-18-2017 , 15:38   add one msg for cmdban
Reply With Quote #1

hello guys
i using this code of ban command:

PHP Code:
public cmdBan(idlevelcid)
{
    if (!
cmd_access(idlevelcid3))
        return 
PLUGIN_HANDLED
    
    
new target[32], minutes[8], reason[64]
    
    
read_argv(1target31)
    
read_argv(2minutes7)
    
read_argv(3reason63)
    
    new 
player cmd_target(idtarget9)
    
    if (!
player)
        return 
PLUGIN_HANDLED
    
    
new authid[32], name2[32], authid2[32], name[32]
    new 
userid2 get_user_userid(player)
    
    
get_user_authid(playerauthid231)
    
get_user_authid(idauthid31)
    
get_user_name(playername231)
    
get_user_name(idname31)
    
    
    new 
temp[64], banned[16], nNum str_to_num(minutes)
    if (
nNum)
        
format(temp63"Ai primit ban pentru %s minute"minutes)
    else
        
format(temp63"Ai primit ban permanent Permanent"player"PERM")
    
format(banned15""player"BANNED")

    new 
address[32]
    
get_user_ip(playeraddress311)

    if (
reason[0])
        
server_cmd("kick #%d ^"%(%%s)^";wait;addip ^"%s^" ^"%s^";wait;writeip"userid2reasonbannedtempminutesaddress)
    else
        
server_cmd("kick #%d ^"%%s^";wait;addip ^"%s^" ^"%s^";wait;writeip"userid2bannedtempminutesaddress)

    new 
pl[32];
    
get_user_name(playerpl31)
        
    
client_print_color(0GREY"^1[ADMIN]^4 %s^1: banned ^4%s ^1for ^4%s ^1minutes"nameplminutes);
    
client_cmd(player"wait;snapshot;wait");
        
    new 
activity get_cvar_num("amx_show_activity")
    if (
activity != 0)
    {

    }
    
console_print(id"Jucatorul %s a fost banat"name2)
    
    return 
PLUGIN_HANDLED

well, when i use cmd amx_ban name 0
i will see in chat: admin name: ban name for 0 minutes

well?
i want if i use amx_ban 0
i want to see in chat , Admin name: ban name permanently

i tried so much codes
like

PHP Code:
    if (minutes[player] == 0)
    {
        
client_print_color(0GREY"^1[ADMIN]^4 %s^1: banned ^4%s ^3permanently"namepl);
    } 
and

PHP Code:
    if (minutes[player] < 1)
    {
        
client_print_color(0GREY"^1[ADMIN]^4 %s^1: banned ^4%s ^3permanently"namepl);
    } 
but not working msg in chat....


so anyone have idea?

Last edited by bakir123; 09-18-2017 at 15:39. Reason: msh to msg
bakir123 is offline
Send a message via Skype™ to bakir123
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-18-2017 , 21:34   Re: add one msg for cmdban
Reply With Quote #2

minutes[player] is not valid. minutes is a string that contains the text of the number. Whether or not it is a permanent ban is determined by the condition: if(nNum) where nNum is the number of minutes. If you need to know if the ban is permanent, you can use that.

Also note that the format() in the else case of the if(nNum) is not done properly.
__________________

Last edited by fysiks; 09-18-2017 at 21:38.
fysiks is offline
bakir123
Senior Member
Join Date: Jan 2015
Location: Palestine, Hebron
Old 09-18-2017 , 22:18   Re: add one msg for cmdban
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
minutes[player] is not valid. minutes is a string that contains the text of the number. Whether or not it is a permanent ban is determined by the condition: if(nNum) where nNum is the number of minutes. If you need to know if the ban is permanent, you can use that.

Also note that the format() in the else case of the if(nNum) is not done properly.

So what code I must use ?
bakir123 is offline
Send a message via Skype™ to bakir123
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-19-2017 , 09:33   Re: add one msg for cmdban
Reply With Quote #4

Quote:
Originally Posted by bakir123 View Post
So what code I must use ?
nNum is the number of minutes for the ban.
__________________
fysiks is offline
bakir123
Senior Member
Join Date: Jan 2015
Location: Palestine, Hebron
Old 09-19-2017 , 09:41   Re: add one msg for cmdban
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
nNum is the number of minutes for the ban.

Problem solved.
Thanks you too.

Last edited by bakir123; 09-19-2017 at 11:24.
bakir123 is offline
Send a message via Skype™ to bakir123
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 12:01.


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