Offline ban 2
#1

Hey guyz sup here i made that offline ban cmd and it work but i want admin must give reason to ban that player
i tried but it isnt working also i wanna add read player file and if he is admin as well dont ban him
code

PHP код:
CMD:oban(playeridparams[]) {
    if(
IsPlayerAdmin(playerid)) {
    if(
isnull(params)) return SendClientMessage(playeridred"USAGE: /oban [Username] [Reason]");
    new 
string[300],reason[50],adminname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridadminnamesizeof(adminname));
    if(
udb_Exists(params)) {
    if(
== dUserINT(params).("banned")) return SendClientMessage(playerid,red,"ERROR: Player is already banned");
    
CMDMessageToAdmins(playerid,"Oban");
    
dUserSetINT(params).("Banned",1);
    new 
year,month,day,hour,minuite,secondgetdate(yearmonthday); gettime(hour,minuite,second);
    
format(string,sizeof(string),"%s has been offline banned by Administrator %s [Reason: %s] [Date: %d/%d/%d] [Time: %d:%d]",params,adminname,reason,day,month,year,hour,minuite);
    return 
SendClientMessage(playerid,blue,string);
    } else return 
SendClientMessage(playeridred,"ERROR: File doesnt exist, player isnt registered");
    } else return 
SendClientMessage(playeridred,"ERROR: You need to be RCON to use this command");

Reply
#2

I do not know if is this, I am not good at English. :c

Код:
CMD:oban(playerid, params[]) 
{ 
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, red,"ERROR: You need to be RCON to use this command"); 
	
	if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /oban [Username] [Reason]"); 
	
	new string[300],reason[50],adminname[MAX_PLAYER_NAME]; 
	
	GetPlayerName(playerid, adminname, sizeof(adminname)); 
	
	if(udb_Exists(params)) return SendClientMessage(playerid, red,"ERROR: File doesnt exist, player isnt registered"); 
	
	if(1 == dUserINT(params).("banned")) return SendClientMessage(playerid,red,"ERROR: Player is already banned"); 
	
	CMDMessageToAdmins(playerid,"Oban"); 
	
	dUserSetINT(params).("Banned",1); 
	
	new year,month,day,hour,minuite,second; getdate(year, month, day); gettime(hour,minuite,second); 
	
	format(string,sizeof(string),"%s has been offline banned by Administrator %s [Reason: %s] [Date: %d/%d/%d] [Time: %d:%d]",params,adminname,reason,day,month,year,hour,minuite); 
	SendClientMessage(playerid,blue,string)
	
	return 1; 
}
Reply
#3

whats the difference betw ur cmd and mine !
bro i asked cmd work perfectly but i want to add banning reason and also if the one who is getting ban is admin so send message u cant ban him bcuz his admin i want these two things
Reply
#4

Anyone ?
Reply
#5

You 're talking about a ban OFFLINE.
You have to compare the names of admins and verify administrative level.
Offline is more complicated than Online.
Reply
#6

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
You 're talking about a ban OFFLINE.
You have to compare the names of admins and verify administrative level.
Offline is more complicated than Online.
I have done everything now j just need adm must give reason of ban
Reply
#7

PHP код:
CMD:oban(playeridparams[]) {
    if(
IsPlayerAdmin(playerid)) {
       new 
reason[50], username[25];
       if(
sscanf(params,"s[25]s",username,reason)) return SendClientMessage(playeridred"USAGE: /oban [Username] [Reason]");
       new 
string[300],adminname[MAX_PLAYER_NAME];
       
GetPlayerName(playeridadminnamesizeof(adminname));
       if(
udb_Exists(username)) {
          if(
dUserINT(username).("banned")) {
              return 
SendClientMessage(playerid,red,"ERROR: Player is already banned");
          }
          if(
dUserINT(username).("level")) {
              return 
SendClientMessage(playerid,red,"ERROR: You can't ban admins nub");
          }
          
CMDMessageToAdmins(playerid,"Oban");
          
dUserSetINT(username).("Banned",1);
          new 
year,month,day,hour,minuite,secondgetdate(yearmonthday); gettime(hour,minuite,second);
          
format(string,sizeof(string),"%s has been offline banned by Administrator %s [Reason: %s] [Date: %d/%d/%d] [Time: %d:%d]",username,adminname,reason,day,month,year,hour,minuite);
          return 
SendClientMessage(playerid,blue,string);
        }
        else {
           return 
SendClientMessage(playeridred,"ERROR: File doesnt exist, player isnt registered");
        }
    }
    else {
       return 
SendClientMessage(playeridred,"ERROR: You need to be RCON to use this command");
    }

Reply
#8

Quote:
Originally Posted by jlalt
Посмотреть сообщение
PHP код:
CMD:oban(playeridparams[]) {
    if(
IsPlayerAdmin(playerid)) {
       new 
reason[50], username[25];
       if(
sscanf(params,"s[25]s",username,reason)) return SendClientMessage(playeridred"USAGE: /oban [Username] [Reason]");
       new 
string[300],adminname[MAX_PLAYER_NAME];
       
GetPlayerName(playeridadminnamesizeof(adminname));
       if(
udb_Exists(username)) {
          if(
dUserINT(username).("banned")) {
              return 
SendClientMessage(playerid,red,"ERROR: Player is already banned");
          }
          if(
dUserINT(username).("level")) {
              return 
SendClientMessage(playerid,red,"ERROR: You can't ban admins nub");
          }
          
CMDMessageToAdmins(playerid,"Oban");
          
dUserSetINT(username).("Banned",1);
          new 
year,month,day,hour,minuite,secondgetdate(yearmonthday); gettime(hour,minuite,second);
          
format(string,sizeof(string),"%s has been offline banned by Administrator %s [Reason: %s] [Date: %d/%d/%d] [Time: %d:%d]",username,adminname,reason,day,month,year,hour,minuite);
          return 
SendClientMessage(playerid,blue,string);
        }
        else {
           return 
SendClientMessage(playeridred,"ERROR: File doesnt exist, player isnt registered");
        }
    }
    else {
       return 
SendClientMessage(playeridred,"ERROR: You need to be RCON to use this command");
    }

worked perfectly rep +
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)