Portal SAMP
[Ajuda] Código para pegar reporte do player. - Versão de Impressão

+- Portal SAMP (https://portalsamp.com)
+-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5)
+--- Fórum: Área de suporte (https://portalsamp.com/forumdisplay.php?fid=6)
+--- Tópico: [Ajuda] Código para pegar reporte do player. (/showthread.php?tid=1792)

Páginas: 1 2


RE: Código para pegar reporte do player. - xxxjhonatan_wi - 02/11/2021

(02/11/2021 16:04)MrThúúG Escreveu: Você copiou a stock?


Código PHP:
static stock MSGADM(COLOR,const striing[],level)
{
    foreach(Playeri)
    {
        if (PlayerInfo[i][Admin] >= level)
        {
            SendClientMessage(iCOLORstriing);
        }
    }
    printf("%s"striing);
    return true;


Sem Erro \/


Código PHP:
Topo do GM 

new Reportou [MAX_PLAYERS];
new 
Relatou [MAX_PLAYERS];
new 
USOUCMD[MAX_PLAYERS]; 

OnPlayerConnect ou em OnplayerSpawn

Código PHP:
Reportou[playerid] = 0;
Relatou[playerid] = 0;
USOUCMD[playerid] = 0

OnPlayerDisconnect

Código PHP:
Reportou[playerid] = 0;
Relatou[playerid] = 0;
USOUCMD[playerid] = 0


Código PHP:
CMD:reportar(playeridparams[])
{
    new 
ID,motivo[256],Str[256],Str2[256];
    if(
USOUCMD[playerid] > gettime())return SendClientMessage(playerid, -1"Você precisa esperar 20 segundos para fazer outro report!");
    if(
sscanf(params"us[256]"IDmotivo))return SendClientMessage(playerid0xB4B5B7FF"USE: /reportar [id] [motivo]");
    if(!
IsPlayerConnected(ID))return SendClientMessage(playerid0xB4B5B7FF" Este player está off-line !");
    if(
playerid == ID) return SendClientMessage(playerid, -1"[ERRO] > Você não pode se reportar.");
    if(
strlen(motivo) > 30 )return SendClientMessageplayerid0xAA3333AA"[ x ] Report muito grande !" );
    
SetPVarString(playerid"NomeReport",pName(ID));
    
SetPVarInt(playerid"ID",ID);
    
SetPVarString(playerid"Motivo",motivo);
    
format(Strsizeof(Str), "| INFO | > {00FF00}%s(%d) {FFFFFF}reportou {FF0000}%s:(%d) {FFFFFF}motivo: {20B2AA}%s"pName(playerid),playeridpName(ID),ID,motivo);
    
MSGADM(-1Str1);
    
SetPVarString(playerid"Report",Str);
    
format(Str2sizeof(Str2), "| INFO | > O seu reporte: {20B2AA}%s {FFFFFF}contra: {FF0000}%s(%d) {FFFFFF}foi enviado.",motivo,pName(ID),ID);
    
SendClientMessage(playerid,-1Str2);
    
Reportou[playerid] = 1;
    
USOUCMD[playerid] = gettime() + 20;
    return 
1;
}
CMD:pegarreport(playeridparams [])
{
    if(
PlayerInfo[playerid][Admin] < 1) return SendClientMessage(playeridCOLOR_GRAD1" Você não está autorizado a usar este comando !");
    new 
ID,Str[256],Motivo[256],Motivo2[256],Nome[30],Report[256];
    if(
sscanf(params"u"ID)) return SendClientMessage(playerid, -1"[ERRO] > Comando correto: /pegarreport [ID]");
    if(!
IsPlayerConnected(ID)) return SendClientMessage(playerid, -1"[ERRO] > ID nao conectado.");
    if(
Reportou[ID] == 1)
    {
        
GetPVarString(ID"NomeReport"Nomesizeof(Nome));
        
GetPVarString(ID"Report"Motivosizeof(Motivo));
        
GetPVarString(ID"Motivo"Motivo2sizeof(Motivo2));
        
format(Strsizeof(Str), "{20B2AA} o Admin: %s(%d) {FFFFFF}leu o seu report: {20B2AA}%s. {FFFFFF}contra: {FF0000}%s(%d).",pName(playerid),playerid,Motivo2,Nome,GetPVarInt(playerid"ID"));
          SendClientMessage(ID,-1Str);
          SendClientMessage(playerid0xB4B5B7FF"==================================================== REPORT ====================================================");
        
format(Report,sizeof(Report), "%s",Motivo);
        
SendClientMessage(playerid, -1Report);
        
SendClientMessage(playerid0xB4B5B7FF"==================================================== REPORT ====================================================");
        Reportou[ID] = 0;
        DeletePVar(ID"NomeReport");
        DeletePVar(ID"Report");
        DeletePVar(ID"Motivo");
        DeletePVar(ID"ID");
    }else{
        new 
NReport[50];
        
format(NReportsizeof(NReport), "|INFO| > %s:(%d) Não fez nenhum report."pName(ID),ID);
        
SendClientMessage(ID, -1NReport);
    }
    return 
1;
}

CMD:relatorio(playeridparams[])
{
    new 
Relatorio[256],Str[256],Str2[256];
    if(
USOUCMD[playerid] > gettime())return SendClientMessage(playerid, -1"Você precisa esperar 20 segundos para fazer outro relatorio!");
    if(
sscanf(params"s[256]"Relatorio))return SendClientMessage(playerid0xB4B5B7FF"USE: /relatorio [msg]");
    if(
strlen(Relatorio) > 70 )return SendClientMessageplayerid0xAA3333AA"[ x ] Relatorio muito grande !" );
    
format(Strsizeof(Str), "| INFO | >{FF0000}%s:(%d) {FFFFFF}Relatou: {20B2AA}%s.",pName(playerid),playerid,Relatorio);
    
MSGADM(-1Str1);
    
SetPVarString(playerid"Relatorio",Str);
    
format(Str2sizeof(Str2), "| INFO | > Relatorio: {20B2AA}%s {FFFFFF}Enviado.",Relatorio);
    
SendClientMessage(playerid,-1Str2);
    
Relatou[playerid] = 1;
    
USOUCMD[playerid] = gettime() + 20;
    return 
1;
}
CMD:pegarrelatorio(playeridparams [])
{
    if(
PlayerInfo[playerid][Admin] < 1) return SendClientMessage(playeridCOLOR_GRAD1" Você não está autorizado a usar este comando !");
    new 
ID,Str[256],Str2[256],Relatorio[256];
    if(
sscanf(params"u"ID)) return SendClientMessage(playerid, -1"[ERRO] > Comando correto: /pegarrelatorio [ID]");
    if(!
IsPlayerConnected(ID)) return SendClientMessage(playerid, -1"[ERRO] > ID nao conectado.");
    if(
Relatou[ID] == 1)
    {
        
GetPVarString(ID,"Relatorio",Relatorio,sizeof(Relatorio));
        
format(Strsizeof(Str), "{20B2AA} o Admin: %s(%d) {FFFFFF}leu o seu relatorio: {20B2AA}%s.",pName(playerid),playerid,Relatorio);
          SendClientMessage(ID,-1Str);
          SendClientMessage(playerid0xB4B5B7FF"==================================================== RELATORIO ====================================================");
        
format(Str2,sizeof(Str2), "%s",Relatorio);
        
SendClientMessage(playerid, -1Str2);
        
SendClientMessage(playerid0xB4B5B7FF"==================================================== RELATORIO ====================================================");
        
Relatou[ID] = 0;
         
DeletePVar(ID"Relatorio");
    }else{
        new 
NRelatou[50];
        
format(NRelatousizeof(NRelatou), "|INFO| > %s:(%d) Não fez nenhum relatorio."pName(ID),ID);
        
SendClientMessage(ID, -1NRelatou);
    }
    return 
1;
}

static 
stock MSGADM(COLOR,const striing[],level)
{
    foreach(
Playeri)
    {
        if (
PlayerInfo[i][Admin] >= level)
        {
            
SendClientMessage(iCOLORstriing);
        }
    }
    
printf("%s"striing);
    return 
true;


Está tudo funcionando! Obrigado mesmoooo