18.05.2013, 18:20
Hello guys, I have this code in a filterscript under OnPlayerConnect
And I have this code in the gamemode under OnPlayerConnect
The problem is that every time I log-in, I have to log-in for both systems. In a nutshell, I need the register and login system of the code in the gamemode and I want it to work with the filterscript. In other words, merging them in a way by which I log-in and register with the same interface of the code in the gamemode, but it saves in the system in the filterscript, as this filterscript has a command of /checkstats that I need, so I don't know how, is it possible. Thank you.
pawn Код:
public OnPlayerConnect(playerid)
{
format(file, 128, "/tReg/%s.ini", GetName(playerid));
GetPlayerIp(playerid, playerIP, 16);
TogglePlayerSpectating(playerid, 1);
if(!dini_Exists(file))
{
format(str, 128, "Welcome %s \n\nPlease register your account", GetName(playerid));
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Account Management", str, "Register", "Quit");
}
if(dini_Exists(file))
{
if(strcmp(playerIP, dini_Get(file, "IP"), true) == 0)
{
dini_Set(file, "IP", playerIP);
SetPVarInt(playerid, "Logged", 1);
SetPlayerCash(playerid, dini_Int(file, "Money"));
SetPlayerScore(playerid, dini_Int(file, "Score"));
SetPVarInt(playerid, "Kills", dini_Int(file, "Kills"));
SetPVarInt(playerid, "Deaths", dini_Int(file, "Deaths"));
SetPVarInt(playerid, "Time", dini_Int(file, "Minutes Ingame"));
Update = SetTimerEx("UpdateTime", 60*1000, 1, "i", playerid);
SendClientMessage(playerid, colorGreen, "You have been automatically logged in.");
}
else
{
format(str, 128, "Welcome %s \n\nPlease login to your account", GetName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Account Management", str, "Login", "Quit");
}
}
return 1;
}
pawn Код:
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,COL_LIGHTBLUE"Login","Welcome back to Infusion Gaming.\n\nThat name is registered. Please enter your password below.","Login","Quit"); //login
format(string, sizeof(string), ""COL_WHITE"Welcome to "COL_LIGHTBLUE"Infusion Gaming, "COL_WHITE"%s!", GetPlayerFirstName(playerid));
SendClientMessage(playerid, -1, string);
}
else
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,COL_LIGHTBLUE"Register","Welcome to Infusion Gaming.\n\nPlease register your account by typing the password below.","Register","Quit");
format(string, sizeof(string), ""COL_WHITE"Welcome to "COL_LIGHTBLUE"Infusion Gaming, "COL_WHITE"%s!", GetPlayerFirstName(playerid));
SendClientMessage(playerid, -1, string);
}
if(!IsValidName(playerid) && !IsPlayerNPC(playerid) && PlayerInfo[playerid][pAdmin] < 2)
{
format(string, sizeof(string), "AdmCmd: %s has been kicked by NameChecker, reason: Invalid name format.", GetName(playerid));
SendClientMessage(playerid, COLOR_LIGHTRED, "You've been kicked by NameChecker, reason: Invalid name format. (Firstname_Lastname)");
Kick(playerid);
}
SetPlayerInterior(playerid,0);
TogglePlayerSpectating(playerid, 1);
gPlayerLogged[playerid] = 1;
RefuelTime[playerid] = 0;
TrackCar[playerid] = 0;
return 1;
}