Problem Reason save Date -
Xprototype - 25.10.2013
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
Re : Problem Reason save Date -
Xprototype - 25.10.2013
Up...
Re : Problem Reason save Date -
Xprototype - 25.10.2013
Up please...
Re: Problem Reason save Date -
SilentSoul - 25.10.2013
Show us your player enum data , and ban command
Re : Problem Reason save Date -
Xprototype - 25.10.2013
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;
}
Re: Problem Reason save Date -
SilentSoul - 25.10.2013
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
Re : Problem Reason save Date -
Xprototype - 25.10.2013
Edit : Not working
PHP код:
708) :error 017: undefined symbol "WriteInFile"
Line 708:
PHP код:
WriteInFile(str, logfile);
Re : Problem Reason save Date -
Xprototype - 25.10.2013
Up..
Re: Problem Reason save Date -
SilentSoul - 25.10.2013
Show me your OnDialogResponse please.
Re : Problem Reason save Date -
Xprototype - 25.10.2013
Ok,
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_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(playerid, DIALOG_SUCCESS_1, DIALOG_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(playerid, PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid,PlayerInfo[playerid][pScore]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Vous vous кtes correctement connectй!","Ok","");
}
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_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;
}