forward OnPlayerLogin(playerid,password[]);
forward OnPlayerRegister(playerid, password[]);
public OnPlayerLogin(playerid,password[])
{
if(IsPlayerNPC(playerid)) return 1;
new file[64];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(file, sizeof(file), "/Users/%s.ini", playername3);
if (dini_Exists(file))
{
new password2 = num_hash(password);
if(dini_Int(file,"Password") == password2)
{
Member[playerid] = dini_Int(file, "Member");
Leader[playerid] = dini_Int(file,"Leader");
IsInOrg[playerid] = dini_Int(file,"Status");
IsLaw[playerid] = dini_Int(file,"Law");
request[playerid] = dini_Int(file,"Request");
IsRequesting[playerid] = dini_Int(file,"Isrequesting");
SetPlayerScore(playerid, dini_Int(file,"Score"));
SetPlayerMoney(playerid, dini_Int(file,"Cash"));
Jail[playerid] = dini_Int(file, "Jail");
PlayerInfo[playerid][Admin] = dini_Int(file, "Admin");
Radio[playerid] = dini_Int(file, "Radio");
}
else
{
gPlayerLogTries[playerid] += 1;
ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Once againg!",""ALB"You have typed a wrong password\n"ALB"Type your password here to log-in!","Log-in","Quit");
return 1;
}
}
SpawnPlayer(playerid);
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1234)
{
if(response)
{
if(IsPlayerNPC(playerid)) return 1;
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
new string[64];
format(string, sizeof(string), "/Users/%s.ini", playername);
if (dini_Exists(string))
{
ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Welcome.Please log-in.",""ALB"Type your password here to log-in","Log-in","Quit");
}
else
{
ShowPlayerDialog(playerid, 1246, DIALOG_STYLE_INPUT,""ALB"Please register!",""ALB"Type your password here to register.","Register","Quit");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY,"*You refused. You must accept the rules to play.");
}
}
if(dialogid == 1245)
{
if(response)
{
strmid(Typed[playerid], inputtext, 0, strlen(inputtext), 255);
if(!strcmp(Typed[playerid], "None", true))
{
ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Once again.",""ALB"You didn't type a correct password!\n"ALB"Type you password here to register.","Log-in","Quit");
}
else
{
OnPlayerLogin(playerid, inputtext);
}
}
}
if(dialogid == 1246)
{
if(response == 1)
{
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[512];
format(string, sizeof(string),""ALB"Nume: "LIGHTBLUE"%s\n"ALB"Pass: "LIGHTBLUE"%s,\n"ALB"Money: "LIGHTBLUE"10000\n"ALB"Score: "LIGHTBLUE"500",sendername,inputtext);
ShowPlayerDialog(playerid, 1242, DIALOG_STYLE_MSGBOX, ""LIGHTBLUE"Account succesfully registred",string,"Ok","");
OnPlayerRegister(playerid, inputtext);
}
}
return 1;
}
This is a nice release. Too bad it did not work as planned. Anyways, did you compile it?
|
You have to compile it before testing it...............
OP: It's a bug. Try using SetPlayerSpawnInfo before using SpawnPlayer. |
This is a nice release. Too bad it did not work as planned. Anyways, did you compile it?
|
He means that when you use SpawnPlayer while in class selection with SA-MP 0.3d R2, the kicks you at spawn. This can be fixed by using the function SetSpawnInfo before SpawnPlayer or by downloading SA-MP 0.3d R1.
![]() |
SetSpawnInfo(playerid, 0, 0, 0.0, 0.0, 5.0, 0.0, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid);