SA-MP Forums Archive
Offline ban 2 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Offline ban 2 (/showthread.php?tid=606377)



Offline ban 2 - Miller007 - 03.05.2016

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");




Re: Offline ban 2 - F1N4L - 03.05.2016

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; 
}



Re: Offline ban 2 - Miller007 - 03.05.2016

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


Re: Offline ban 2 - Miller007 - 03.05.2016

Anyone ?


Re: Offline ban 2 - F1N4L - 03.05.2016

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.


Re: Offline ban 2 - Miller007 - 04.05.2016

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


Re: Offline ban 2 - jlalt - 04.05.2016

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");
    }




Re: Offline ban 2 - Miller007 - 04.05.2016

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 +