if(dialogid == DIALOG_LOGIN) { if(!response) { SendClientMessage(playerid, GREY, "Vous n'etes pas connecter."); Kick(playerid); } if(response) { if(!strlen(inputtext)) { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Connection","Vous avez entrй un mot de passe incorrect.\nMerci de mettre le vrais pour vous connecter.","Connection","Quitter"); } else if(strlen(inputtext) < 4) { SendClientMessage(playerid, GREY, "Minimum 4 characters."); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Connection","Vous avez entrй un mot de passe incorrect.\nMerci de mettre le vrais pour vous connecter.","Connection","Quitter"); } if(INI_Open(Accounts(playerid))) { INI_ReadString(PlayerStat[playerid][Password],"Password",20); if(strcmp(inputtext,PlayerStat[playerid][Password],false)) { if(PlayerStat[playerid][WrongPw] == 1) { SendClientMessage(playerid, GREY, "Vous avez йtй kick pour mot de passe incorrecte."); Kick(playerid); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Connection","Vous avez entrй un mot de passe incorrect.\nMerci de mettre le vrais pour vous connecter.","Connection","Quitter"); SendClientMessage(playerid, GREY, "Vous avez seulement une derniиre chance d'entrer le mot de passe de ce compte ou vous serrez kick."); PlayerStat[playerid][WrongPw] = 1; TogglePlayerControllable(playerid, false); SetPlayerInterior(playerid,5); SetPlayerVirtualWorld(playerid, playerid+0); SetSpawnInfo(playerid, 0, 0, 1825.1848,-1723.9135,5202.5859 , 0, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); SetPlayerCameraPos(playerid, 1752.4188, -1527.8185, 20.2753); SetPlayerCameraLookAt(playerid, 1753.0366, -1528.6036, 19.8853); } } else { new str[128]; format(str, sizeof(str), "Bienvenue %s sur BadJail RolePlay, ", GetOOCName(playerid)); SendClientMessage(playerid, GREEN, str); format(str, sizeof(str), "~w~Bienvenue ~n~~y~ %s", GetOOCName(playerid)); GameTextForPlayer(playerid, str, 3000, 1); SendClientMessage(playerid, GREEN, SERVER_MOTD); new Hour, Minute, Second; new Day, Month, Year; gettime(Hour, Minute, Second); getdate(Year, Month, Day); PlayerStat[playerid][LastLoginSecond] = Second; PlayerStat[playerid][LastLoginMinute] = Minute; PlayerStat[playerid][LastLoginHour] = Hour; PlayerStat[playerid][LastLoginDay] = Day; PlayerStat[playerid][LastLoginMonth] = Month; PlayerStat[playerid][LastLoginYear] = Year; INI_WriteInt("LastLoginSecond",PlayerStat[playerid][LastLoginSecond]); INI_WriteInt("LastLoginMinute",PlayerStat[playerid][LastLoginMinute]); INI_WriteInt("LastLoginHour",PlayerStat[playerid][LastLoginHour]); INI_WriteInt("LastLoginDay",PlayerStat[playerid][LastLoginDay]); INI_WriteInt("LastLoginMonth",PlayerStat[playerid][LastLoginMonth]); INI_WriteInt("LastLoginYear",PlayerStat[playerid][LastLoginYear]); if(PlayerStat[playerid][GangID] >= 1) { format(str, sizeof(str), "Gang MOTD: %s", GangStat[PlayerStat[playerid][GangID]][MOTD]); SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], str); } PlayerStat[playerid][Logged] = 1; LoadPlayerData(playerid); INI_Save(); INI_Close(); } } } } }
new IsConnected[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
// On remet а zйro la variable quand il se connecte pour йviter d'avoir un bug (ex: si le mec avec l'ID 1 dйco le nouveau joueur avec l'ID 1 aura la variable а "1", donc on remet а "0".
IsConnected[playerid] = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
// Quand le joueur est connecter et qu'il est spawn, on lui attribue а 1 la variable.
IsConnected[playerid] = 1;
return 1;
}
CMD:changepass(playerid, params[])
{
if(IsConnected[playerid] == 0) return SendClientMessage(playerid, -1, "Tu n'es pas connecter, tu peut pas changer le mot de passe.");
//Suite de ta commande
return 1;
}
OnPlayerConnect(playerid)
{
// Si MDP incorrect, applique lui зa :
ForceClassSelection(playerid); // = on force le joueur а retourner aux choix des classes
TogglePlayerSpectating(playerid, true); // On le fait retourner aux classes (зa йvite de le kill).
TogglePlayerSpectating(playerid, false); // On le fait retourner aux classes (зa йvite de le kill).
// Oublie pas de retourner.
return 1;
}
else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Connection","Vous avez entrй un mot de passe incorrect.\nMerci de mettre le vrais pour vous connecter.","Connection","Quitter"); SendClientMessage(playerid, GREY, "Vous avez seulement une derniиre chance d'entrer le mot de passe de ce compte ou vous serrez kick."); PlayerStat[playerid][WrongPw] = 1; TogglePlayerControllable(playerid, false); SetPlayerInterior(playerid,5); SetPlayerVirtualWorld(playerid, playerid+0); SetSpawnInfo(playerid, 0, 0, 1825.1848,-1723.9135,5202.5859 , 0, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); SetPlayerCameraPos(playerid, 1752.4188, -1527.8185, 20.2753); SetPlayerCameraLookAt(playerid, 1753.0366, -1528.6036, 19.8853); } } else { new str[128]; format(str, sizeof(str), "Bienvenue %s sur BadJail RolePlay, ", GetOOCName(playerid)); SendClientMessage(playerid, GREEN, str); format(str, sizeof(str), "~w~Bienvenue ~n~~y~ %s", GetOOCName(playerid)); GameTextForPlayer(playerid, str, 3000, 1); SendClientMessage(playerid, GREEN, SERVER_MOTD); new Hour, Minute, Second; new Day, Month, Year; gettime(Hour, Minute, Second); getdate(Year, Month, Day); PlayerStat[playerid][LastLoginSecond] = Second; PlayerStat[playerid][LastLoginMinute] = Minute; PlayerStat[playerid][LastLoginHour] = Hour; PlayerStat[playerid][LastLoginDay] = Day; PlayerStat[playerid][LastLoginMonth] = Month; PlayerStat[playerid][LastLoginYear] = Year; INI_WriteInt("LastLoginSecond",PlayerStat[playerid][LastLoginSecond]); INI_WriteInt("LastLoginMinute",PlayerStat[playerid][LastLoginMinute]); INI_WriteInt("LastLoginHour",PlayerStat[playerid][LastLoginHour]); INI_WriteInt("LastLoginDay",PlayerStat[playerid][LastLoginDay]); INI_WriteInt("LastLoginMonth",PlayerStat[playerid][LastLoginMonth]); INI_WriteInt("LastLoginYear",PlayerStat[playerid][LastLoginYear]); if(PlayerStat[playerid][GangID] >= 1) { format(str, sizeof(str), "Gang MOTD: %s", GangStat[PlayerStat[playerid][GangID]][MOTD]); SendClientMessage(playerid, GangStat[PlayerStat[playerid][GangID]][Color], str); } PlayerStat[playerid][Logged] = 1; LoadPlayerData(playerid); INI_Save(); INI_Close(); }
PHP Code:
|
Le cryptage de les mots de passes а l'air d'кtre magnifique. J'ai bien fais de pas mettre mon vrai.
|