[Ajuda] Colocar motivo no banimento off
#1

Olб! eu tenho um comando que da ban no jogador estando off. Porem ele nгo ponhe o motivo,apenas o nome do adm e do jogador. Poderia ajudar a eu por o motivo? Grato!

PHP код:
dcmd_banirconta(playerid,params[]) {
if(
PlayerInfo[playerid][Level] < 2) return SendClientMessage(playerid,red,"| ERRO | Comando Inexistente.");
if(
strlen(params) < 3) return SendClientMessage(playerid,red,"| ERRO | Digite: /banirconta [Nick do Jogador(a)]");
if(
IsIllegalName(params)) return SendClientMessage(playerid,red,"| ERRO | Nick ilegal!");
if(!
udb_Exists(params)) return SendClientMessage(playerid,red,"| ERRO | A conta nгo Existe!");
if(
PlayerInfo[playerid][Level] < 5){if(dUserINT(params).("level") >= 1) return SendClientMessage(playerid,red,"| ERRO | A conta pertence a um membro da Administraзгo!");}
if(
dUserINT(params).("banned") == 1) return SendClientMessage(playerid,red,"| ERRO | A Conta jб permanece Banida!");
dUserSetINT(params).("banned",1);
new 
SampDotBan[128],file[255];
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(params));
new 
tmp2[256]; tmp2 dini_Get(file,"ip");
format(SampDotBan,sizeof(SampDotBan),"banip %s"tmp2);
SendRconCommand(SampDotBan);
SendRconCommand("reloadbans");
if(
dUserINT(params).("banned") == 1){
CMDMessageToAdmins(playerid,"banirconta");
//--------------- LOGAR
new ADMNAME[MAX_PLAYER_NAME];GetPlayerName(playeridADMNAMEMAX_PLAYER_NAME);
new 
logstring[128];format(logstringsizeof(logstring), "| BAN-LOG | O(A) Admin(a) %s baniu a conta do(a) Jogador(a): (%s)"ADMNAME,params);
SaveToFile("BannedAccs",logstring);
//---------------
SendClientMessage(playerid,azul,"A conta e o IP foi banidas com Sucesso!");
new 
frm[260];
new 
motivo[250];
new 
year,month,day,hour,minuite,secondgetdate(yearmonthday); gettime(hour,minuite,second);
format(frm,sizeof(frm),"| BVD-Admin | O(A) Administrador(a) %s baniu a conta do(a) jogador(a) %s",ADMNAME,params,motivo[2],day,month,year,hour,minuite);
SendClientMessageToAll(red,frm);
}else{
SendClientMessage(playerid,red,"| ERRO | Nгo й possivel banir a conta!");}
return 
1;} 
Reply
#2

Tente isso

PHP код:
dcmd_banirconta(playerid,params[]) {
new 
motivo[250];  //mudei isso
if(PlayerInfo[playerid][Level] < 2) return SendClientMessage(playerid,red,"| ERRO | Comando Inexistente.");
if(
sscanf(params"ss",paramsmotivo)) return Msg(playerid0xFF0000FF"Erro digite /banirconta [Nick do Jogador(a) [ Motivo ]");  //mudei isso
if(IsIllegalName(params)) return SendClientMessage(playerid,red,"| ERRO | Nick ilegal!");
if(!
udb_Exists(params)) return SendClientMessage(playerid,red,"| ERRO | A conta nгo Existe!");
if(
PlayerInfo[playerid][Level] < 5){if(dUserINT(params).("level") >= 1) return SendClientMessage(playerid,red,"| ERRO | A conta pertence a um membro da Administraзгo!");}
if(
dUserINT(params).("banned") == 1) return SendClientMessage(playerid,red,"| ERRO | A Conta jб permanece Banida!");
dUserSetINT(params).("banned",1);
new 
SampDotBan[128],file[255];
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(params));
new 
tmp2[256]; tmp2 dini_Get(file,"ip");
format(SampDotBan,sizeof(SampDotBan),"banip %s"tmp2);
SendRconCommand(SampDotBan);
SendRconCommand("reloadbans");
if(
dUserINT(params).("banned") == 1){
CMDMessageToAdmins(playerid,"banirconta");
//--------------- LOGAR
new ADMNAME[MAX_PLAYER_NAME];GetPlayerName(playeridADMNAMEMAX_PLAYER_NAME);
new 
logstring[128];format(logstringsizeof(logstring), "| BAN-LOG | O(A) Admin(a) %s baniu a conta do(a) Jogador(a): (%s)"ADMNAME,params);
SaveToFile("BannedAccs",logstring);
//---------------
SendClientMessage(playerid,azul,"A conta e o IP foi banidas com Sucesso!");
new 
frm[260];
new 
year,month,day,hour,minuite,secondgetdate(yearmonthday); gettime(hour,minuite,second);
format(frm,sizeof(frm),"| BVD-Admin | O(A) Administrador(a) %s baniu a conta do(a) jogador(a) %s Motivo %s",ADMNAME,params,motivo,day,month,year,hour,minuite);  //mudei isso
SendClientMessageToAll(red,frm);
}else{
SendClientMessage(playerid,red,"| ERRO | Nгo й possivel banir a conta!");}
return 
1;} 
Reply
#3

Eu faria assim.

obs:Eu editei o cуdigo do lHesoyaml.
PHP код:
dcmd_banirconta(playerid,params[])  
{  
    new 
motivo[50],Nick[24];  //mudei isso  
    
if(PlayerInfo[playerid][Level] < 2)  
        return 
SendClientMessage(playerid,red,"| ERRO | Comando Inexistente.");  
    if(
sscanf(params"s[24]s[50]",Nickmotivo))  
        return 
Msg(playerid0xFF0000FF"Erro digite /banirconta [Nick do Jogador(a) [ Motivo ]");  //mudei isso  
    
if(IsIllegalName(Nick))  
        return 
SendClientMessage(playerid,red,"| ERRO | Nick ilegal!");  
    if(!
udb_Exists(Nick))  
        return 
SendClientMessage(playerid,red,"| ERRO | A conta nгo Existe!");  
    if(
PlayerInfo[playerid][Level] < 5){if(dUserINT(Nick).("level") >= 1)  
        return 
SendClientMessage(playerid,red,"| ERRO | A conta pertence a um membro da Administraзгo!");}  
    if(
dUserINT(Nick).("banned") == 1)  
        return 
SendClientMessage(playerid,red,"| ERRO | A Conta jб permanece Banida!");  
    
dUserSetINT(Nick).("banned",1);  
    new 
SampDotBan[48],file[50];  
    
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(Nick));  
    new 
tmp2[20]; 
    
tmp2 dini_Get(file,"ip");  
    
format(SampDotBan,sizeof(SampDotBan),"banip %s"tmp2);  
    
SendRconCommand(SampDotBan);  
    
SendRconCommand("reloadbans");  
    if(
dUserINT(Nick).("banned") == 1){  
        
CMDMessageToAdmins(playerid,"banirconta");  
        
//--------------- LOGAR  
        
static ADMNAME[MAX_PLAYER_NAME];
        
GetPlayerName(playeridADMNAMEMAX_PLAYER_NAME);  
        new 
logstring[95];
          
format(logstringsizeof(logstring), "| BAN-LOG | O(A) Admin(a) %s baniu a conta do(a) Jogador(a): (%s)"ADMNAME,Nick);  
        
SaveToFile("BannedAccs",logstring);  
        
//---------------  
        
SendClientMessage(playerid,azul,"A conta e o IP foi banidas com Sucesso!");  
        new 
frm[150];  
        new 
year,month,day,hour,minuite,second
        
getdate(yearmonthday); 
        
gettime(hour,minuite,second);  
        
format(frm,sizeof(frm),"| BVD-Admin | O(A) Administrador(a) %s baniu a conta do(a) jogador(a) %s Motivo %s",ADMNAME,Nick,motivo,day,month,year,hour,minuite);  //mudei isso  
        
SendClientMessageToAll(red,frm);  
    }else{  
        
SendClientMessage(playerid,red,"| ERRO | Nгo й possivel banir a conta!");
    }  
    return 
1

Melhorei um pouco o cуdigo atual.
Reply
#4

Quote:
Originally Posted by Marllun
Посмотреть сообщение
Eu faria assim.

obs:Eu editei o cуdigo do lHesoyaml.
PHP код:
dcmd_banirconta(playerid,params[])  
{  
    new 
motivo[50],Nick[24];  //mudei isso  
    
if(PlayerInfo[playerid][Level] < 2)  
        return 
SendClientMessage(playerid,red,"| ERRO | Comando Inexistente.");  
    if(
sscanf(params"s[24]s[50]",Nickmotivo))  
        return 
Msg(playerid0xFF0000FF"Erro digite /banirconta [Nick do Jogador(a) [ Motivo ]");  //mudei isso  
    
if(IsIllegalName(Nick))  
        return 
SendClientMessage(playerid,red,"| ERRO | Nick ilegal!");  
    if(!
udb_Exists(Nick))  
        return 
SendClientMessage(playerid,red,"| ERRO | A conta nгo Existe!");  
    if(
PlayerInfo[playerid][Level] < 5){if(dUserINT(Nick).("level") >= 1)  
        return 
SendClientMessage(playerid,red,"| ERRO | A conta pertence a um membro da Administraзгo!");}  
    if(
dUserINT(Nick).("banned") == 1)  
        return 
SendClientMessage(playerid,red,"| ERRO | A Conta jб permanece Banida!");  
    
dUserSetINT(Nick).("banned",1);  
    new 
SampDotBan[48],file[50];  
    
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(Nick));  
    new 
tmp2[20]; 
    
tmp2 dini_Get(file,"ip");  
    
format(SampDotBan,sizeof(SampDotBan),"banip %s"tmp2);  
    
SendRconCommand(SampDotBan);  
    
SendRconCommand("reloadbans");  
    if(
dUserINT(Nick).("banned") == 1){  
        
CMDMessageToAdmins(playerid,"banirconta");  
        
//--------------- LOGAR  
        
static ADMNAME[MAX_PLAYER_NAME];
        
GetPlayerName(playeridADMNAMEMAX_PLAYER_NAME);  
        new 
logstring[95];
          
format(logstringsizeof(logstring), "| BAN-LOG | O(A) Admin(a) %s baniu a conta do(a) Jogador(a): (%s)"ADMNAME,Nick);  
        
SaveToFile("BannedAccs",logstring);  
        
//---------------  
        
SendClientMessage(playerid,azul,"A conta e o IP foi banidas com Sucesso!");  
        new 
frm[150];  
        new 
year,month,day,hour,minuite,second
        
getdate(yearmonthday); 
        
gettime(hour,minuite,second);  
        
format(frm,sizeof(frm),"| BVD-Admin | O(A) Administrador(a) %s baniu a conta do(a) jogador(a) %s Motivo %s",ADMNAME,Nick,motivo,day,month,year,hour,minuite);  //mudei isso  
        
SendClientMessageToAll(red,frm);  
    }else{  
        
SendClientMessage(playerid,red,"| ERRO | Nгo й possivel banir a conta!");
    }  
    return 
1

Melhorei um pouco o cуdigo atual.
Obg! mais deu esses erros

PHP код:
C:\Users\Pedro Tramontina\Desktop\Projeto SA-MP\filterscripts\ladmin4v2.pwn(2193) : error 017undefined symbol "sscanf"
C:\Users\Pedro Tramontina\Desktop\Projeto SA-MP\filterscripts\ladmin4v2.pwn(2194) : error 017undefined symbol "Msg"
C:\Users\Pedro Tramontina\Desktop\Projeto SA-MP\filterscripts\ladmin4v2.pwn(2207) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
3 Errors

Reply
#5

PHP код:
dcmd_banirconta(playerid,params[])   
{   
    new 
motivo[50],Nick[24];  //mudei isso   
    
if(PlayerInfo[playerid][Level] < 2)   
        return 
SendClientMessage(playerid,red,"| ERRO | Comando Inexistente.");   
    if(
sscanf(params"s[24]s[50]",Nickmotivo))   
        return 
SendClientMessage(playerid0xFF0000FF"Erro digite /banirconta [Nick do Jogador(a) [ Motivo ]");  //mudei isso   
    
if(IsIllegalName(Nick))   
        return 
SendClientMessage(playerid,red,"| ERRO | Nick ilegal!");   
    if(!
udb_Exists(Nick))   
        return 
SendClientMessage(playerid,red,"| ERRO | A conta nгo Existe!");   
    if(
PlayerInfo[playerid][Level] < 5){if(dUserINT(Nick).("level") >= 1)   
        return 
SendClientMessage(playerid,red,"| ERRO | A conta pertence a um membro da Administraзгo!");}   
    if(
dUserINT(Nick).("banned") == 1)   
        return 
SendClientMessage(playerid,red,"| ERRO | A Conta jб permanece Banida!");   
    
dUserSetINT(Nick).("banned",1);   
    new 
SampDotBan[128],file[128];   
    
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(Nick));   
    new 
tmp2[50];  
    
tmp2 dini_Get(file,"ip");   
    
format(SampDotBan,sizeof(SampDotBan),"banip %s"tmp2);   
    
SendRconCommand(SampDotBan);   
    
SendRconCommand("reloadbans");   
    if(
dUserINT(Nick).("banned") == 1){   
        
CMDMessageToAdmins(playerid,"banirconta");   
        
//--------------- LOGAR   
        
static ADMNAME[MAX_PLAYER_NAME]; 
        
GetPlayerName(playeridADMNAMEMAX_PLAYER_NAME);   
        new 
logstring[95]; 
          
format(logstringsizeof(logstring), "| BAN-LOG | O(A) Admin(a) %s baniu a conta do(a) Jogador(a): (%s)"ADMNAME,Nick);   
        
SaveToFile("BannedAccs",logstring);   
        
//---------------   
        
SendClientMessage(playerid,azul,"A conta e o IP foi banidas com Sucesso!");   
        new 
frm[150];   
        new 
year,month,day,hour,minuite,second;  
        
getdate(yearmonthday);  
        
gettime(hour,minuite,second);   
        
format(frm,sizeof(frm),"| BVD-Admin | O(A) Administrador(a) %s baniu a conta do(a) jogador(a) %s Motivo %s",ADMNAME,Nick,motivo,day,month,year,hour,minuite);  //mudei isso   
        
SendClientMessageToAll(red,frm);   
    }else{   
        
SendClientMessage(playerid,red,"| ERRO | Nгo й possivel banir a conta!"); 
    }   
    return 
1;  

baixe o plugin sscanf

https://github.com/maddinat0r/sscanf....8.2-win32.zip
Reply
#6

obg!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)