Problem Reason save Date
#1

Hello,
I have a system ban to ban account and I would like if his account is banned as soon as he logs in there is the date, time and reason the admin who banned in dialogue I know to the dialogue.
Thanks for your help.
EDIT: I Used YSI/INI
Reply
#2

Up...
Reply
#3

Up please...
Reply
#4

Show us your player enum data , and ban command
Reply
#5

Ok,
PHP код:
enum pInfo
{
    
pPass,
    
pCash,
    
pAdmin,
    
pKills,
    
pScore,
    
pBan,
    
pDeaths
}
new 
PlayerInfo[MAX_PLAYERS][pInfo]; 
Command :
PHP код:
CMD:ban(playerid,params[])
{
new 
Joueur[MAX_PLAYER_NAME];
new 
Admin[MAX_PLAYER_NAME];
new 
id;
new 
raison[64];
new 
string[128];
new 
Heure,Minute,Seconde;
new 
Jour,Mois,Anne;
getdate(Jour,Mois,Anne);
gettime(Heure,Minute,Seconde);
if(
PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,0xC0C0C0FF,"Vous n'avez pas accиs а cette commande.");
if(
sscanf(params,"us[64]",id,raison)) return SendClientMessage(playerid,0xC0C0C0FF,"Usage : /ban [id] [raison]");
GetPlayerName(playerid,Admin,sizeof(Admin));
GetPlayerName(id,Joueur,sizeof(Joueur));
format(string,sizeof(string),"Le joueur %s(%d) a йtй banni par l'Administrateur %s(%d) Raison: %s Heure: %02d:%02d:%02d Date: %02d/%02d/%d",Joueur,id,Admin,playerid,raison,Heure,Minute,Seconde,Anne,Mois,Jour);
SendClientMessageToAll(0x8395BEFF,string);
SetTimerEx("ban",1000,false,"id",id);
return 
1;

Timer :
PHP код:
forward ban(playerid);
public 
ban(playerid)
{
Ban(playerid);
return 
1;

Reply
#6

pawn Код:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pScore,
    pBan,
    pDeaths,
    pBannedReason[129] //edit that line
}
pawn Код:
CMD:ban(playerid,params[])
{
new Joueur[MAX_PLAYER_NAME];
new Admin[MAX_PLAYER_NAME];
new id;
new raison[64];
new string[128];
new Heure,Minute,Seconde;
new Jour,Mois,Anne;
getdate(Jour,Mois,Anne);
gettime(Heure,Minute,Seconde);
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,0xC0C0C0FF,"Vous n'avez pas accиs а cette commande.");
if(sscanf(params,"us[64]",id,raison)) return SendClientMessage(playerid,0xC0C0C0FF,"Usage : /ban [id] [raison]");
GetPlayerName(playerid,Admin,sizeof(Admin));
GetPlayerName(id,Joueur,sizeof(Joueur));
format(string,sizeof(string),"Le joueur %s(%d) a йtй banni par l'Administrateur %s(%d) Raison: %s Heure: %02d:%02d:%02d Date: %02d/%02d/%d",Joueur,id,Admin,playerid,raison,Heure,Minute,Seconde,Anne,Mois,Jour);
SendClientMessageToAll(0x8395BEFF,string);
SetTimerEx("ban",1000,false,"id",id);
PlayerInfo[playerid][pBan] == 1; //edited part instead of using ban(playerid); because that directly ban his ip every time he will join he will be kicked.
AddLog(string,"Scriptedfilesfoldername/Yournotepadname.txt");
new INI:File = INI_Open(UserFile(playerid))
INI_WriteString(File,"Banned reason",raison);
INI_Close(File);
return 1;
}
And add that anywhere in your script
pawn Код:
stock AddLog(const string[], const logfile[])
{
    new str[150],
        day, month, year,
        hour, minute, second
    ;
    getdate(year, month, day);
    gettime(hour, minute, second);

    format(str, 150, "[%02d-%02d-%04d %02d:%02d:%02d] %s\r\n", day, month, year, hour, minute, second, string);
    WriteInFile(str, logfile);
    return 1;
}
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    new string[126];
    format(string,sizeof(string),"You are banned from playeing in server reason : %s",pBannedReason);
    if(PlayerInfo[playerid][pBan] == 1) return ShowPlayerDialog(playerid,23333,DIALOG_STYLE_MSGBOX,"Banned",string,"ok","");
    return 1;
}
Ps: didn't test that but should work
Reply
#7

Edit : Not working
PHP код:
708) :error 017undefined symbol "WriteInFile" 
Line 708:
PHP код:
WriteInFile(strlogfile); 
Reply
#8

Up..
Reply
#9

Show me your OnDialogResponse please.
Reply
#10

Ok,
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch( 
dialogid )
    {
        case 
DIALOG_REGISTER:
        {
            if (!
response) return Kick(playerid);
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT""COL_WHITE"Enregistrement",""COL_RED"Vous avez entrй un mot de passe invalide\n"COL_WHITE"Entrer un mot de passe afin de vous enregistrer.","S'enregistrer","Quitter");
                new 
INI:File INI_Open(UserPath(playerid));
                
INI_SetTag(File,"data");
                
INI_WriteInt(File,"Password",udb_hash(inputtext));
                
INI_WriteInt(File,"Cash",0);
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"Kills",0);
                
INI_WriteInt(File,"Deaths",0);
                
INI_WriteInt(File,"Score",0);
                
INI_WriteInt(File,"Ban",0);
                
INI_Close(File);
                
ShowPlayerDialog(playeridDIALOG_SUCCESS_1DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Vous avez crйez un compte avec succиs bienvenue sur le serveur!","Ok","");
            }
        }
        case 
DIALOG_LOGIN:
        {
            if ( !
response //return Kick ( playerid );
            
{
            new 
Joueur[MAX_PLAYER_NAME];
            new 
string[128];
            
GetPlayerName(playerid,Joueur,sizeof(Joueur));
            
format(string,sizeof(string),"Le joueur %s a йtй automatiquement kickй Raison : refusй de se loguer.",Joueur);
            
SendClientMessageToAll(0x8395BEFF,string);
            
SetTimerEx("loguer",1000,false,"playerid",playerid);
            }
            if( 
response )
            {
                if(
udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    if(
PlayerInfo[playerid][pBan] == 1)
                    {
                    
SendClientMessage(playerid,-1,"Banni");
                    
ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Banni","Banni","ok","ok");
                    
SetTimerEx("compte",1000,false,"playerid",playerid);
                    }
                    if(
PlayerInfo[playerid][pBan] == 0)
                    {
                    
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
                    
GivePlayerMoney(playeridPlayerInfo[playerid][pCash]);
                    
SetPlayerScore(playerid,PlayerInfo[playerid][pScore]);
                    
ShowPlayerDialog(playeridDIALOG_SUCCESS_2DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Vous vous кtes correctement connectй!","Ok","");
                }
                }
                else
                {
                    
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""COL_WHITE"Connection",""COL_RED"Vous avez entrй un mot de passe invalide.\n"COL_WHITE"Veuillez entrer votre mot de passe pour vous connecter.","Connexion","Quitter");
                }
                return 
1;
            }
        }
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)