public OnPlayerConnect(playerid)
{
gPlayerLogged[playerid] = 0;
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), MafiaAdmin, name);
dini_IntSet(file, "Warns",PlayerInfo[playerid][pWarns] = 1);
if (!dini_Exists(file))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "You Are Not Registerd", "Welcome, you are not registered, please, input your registration password below", "Register", "Leave");
}
if(fexist(file))
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You Are Registerd", "Your account is registered! Now type your password below.", "Login", "Leave");
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), MafiaAdmin, name);
if(gPlayerLogged[playerid] == 1)
{
PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
dini_IntSet(file, "Score", PlayerInfo[playerid][pScore]);
dini_IntSet(file, "Money", PlayerInfo[playerid][pCash]);
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
dini_IntSet(file, "Warns",1);
dini_IntSet(file, "Banned",PlayerInfo[playerid][pBanned]);
dini_IntSet(file, "Muted",PlayerInfo[playerid][pMuted]);
dini_IntSet(file, "Jailed",PlayerInfo[playerid][pJailed]);
}
gPlayerLogged[playerid] = 0;
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == 1)
{
new name[MAX_PLAYER_NAME], file[256], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), MafiaAdmin, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "You are not registered.", "Welcome, your not registered, please, input your registration password below", "Register", "Leave");
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(inputtext));
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 5000);
dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0);
dini_IntSet(file, "Warns",PlayerInfo[playerid][pWarns] = 1);
dini_IntSet(file, "Banned",PlayerInfo[playerid][pBanned] = 0);
dini_IntSet(file, "Muted",PlayerInfo[playerid][pMuted] = 0);
dini_IntSet(file, "Jailed",PlayerInfo[playerid][pJailed] = 0);
format(string, 128, "You have succesfully registered the nickname %s with password %s, you have been auto logged in.", name, inputtext);
SendClientMessage(playerid, COLOR_YELLOW, string);
gPlayerLogged[playerid] = 1;
}
if (dialogid == 2)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), MafiaAdmin, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "Please input your password below.", "Login", "Leave");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp) {
SendClientMessage(playerid, COLOR_RED, "Incorrect password. Please try again.");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered.", "Please input your password below.", "Login", "Leave");
}
else
{
gPlayerLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
SendClientMessage(playerid,COLOR_RED, "You have successfully logged in!");
}
}
return 1;
}
#define MafiaAdmin "Players/%s.ini"
if (!strlen(inputtext)) return
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "You are not registered.", "Welcome, your not registered, please, input your registration password below", "Register", "Leave");
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "You are not registered.", "Welcome, your not registered, please, input your registration password below", "Register", "Leave");
if (!dini_Exists(file))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "You Are Not Registerd", "Welcome, you are not registered, please, input your registration password below", "Register", "Leave");
}
if(fexist(file))
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You Are Registerd", "Your account is registered! Now type your password below.", "Login", "Leave");
}
if(!dini_Exists(file))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "You Are Not Registerd", "Welcome, you are not registered, please, input your registration password below", "Register", "Leave");
}
else
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You Are Registerd", "Your account is registered! Now type your password below.", "Login", "Leave");
}
C:\Users\MarioG\Desktop\SASP\filterscripts\MafiaAdmin.pwn(193) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Warning.
if(!dini_Exists(file))
This fixes that warning
#define tabsize 0 The warning means your code isn't aligned with the other lines-.- |
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext,"/youcommand", true))
{
return 1;
}
return 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext,"/youcommand", true))
{
return 1;
}
return 0;
}
loose identation