Quote:
Originally Posted by JesterlJoker
You could at least show us some codes for us to do something about. There might be something wrong in your codes
you should also provide us with what os your hosting uses. Like for example Linux or Windows since both have different way of running the samp server
|
Code was checked multiple times without any success of fixing, but i will post it once again
On Player Connect
Код:
new name1[MAX_PLAYER_NAME];
GetPlayerName(playerid,name1,sizeof(name1));
if(fexist(Path(playerid)))
{
INI_ParseFile(Path(playerid),"loadaccount_user", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"{4286f4}Account Login","Welcome back to {EFB509}Los Santos DeathMatch Battlefield\n\n{4286f4}This account is registered\n{4286f4}Please insert your password below in order to login!","Login","Quit");
}
else
{
ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"{4286f4}Account Registration","Welcome to {EFB509}Los Santos DeathMatch Battlefield\n\n{4286f4}This account is not registered!\n{4286f4}Please insert your apssword below in order to create an account and play!","Register","Quit");
return 1;
}
On Player Disconnect
Код:
if(fexist(Path(playerid)))//Will check if the file is exit or not inside of User's folder that we have created.
{
new INI:file = INI_Open(Path(playerid)); //will open their file
INI_SetTag(file,"Player's Data");//We will set a tag inside of user's account called "Player's Data"
INI_WriteInt(file,"Admin", pInfo[playerid][Admin]); //If you've set his/her admin level, then his/her admin level will be saved inside of his/her account
INI_WriteInt(file,"Score",GetPlayerScore(playerid));
INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
INI_WriteInt(file,"Points",pInfo[playerid][Points]);
pInfo[playerid][Score] = GetPlayerScore(playerid);
INI_Close(file);
return 1;
}
On Dialog Response
Код:
if(dialogid == dregister)
{//then
if(!response) {
SendClientMessage(playerid, -1 , "{FF0000}(INFO) You have been kicked for not logging in!");
SetTimerEx("OnPlayerKicked", 100, false, "i", playerid);
}
if(response) //if they clicked the first button "Register"
{//then
if(!strlen(inputtext)) //If they didn't enter any password
{// then they are kicked
SendClientMessage(playerid, -1 , "{FF0000}(INFO) You didn't entered any password, for security purposes you must relog !");
SetTimerEx("OnPlayerKicked", 100, false, "i", playerid);
return 1;
}
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file,"Player's Data");
INI_WriteString(file,"Password",hashpass);
INI_WriteInt(file,"Admin",0);
INI_WriteInt(file,"Score",0);
INI_WriteInt(file,"Kills",0);
INI_WriteInt(file,"Deaths",0);
INI_WriteInt(file,"Points",0);
INI_Close(file);
SendClientMessage(playerid,-1,"{EFB509}(INFO) You have successfully created an account! You can start playing now, If you need help use /commands, /rules, /ask");
TogglePlayerSpectating(playerid, 0);
return 1;
}
}
if(dialogid == dlogin)
{//then
if(!response){
SendClientMessage(playerid, -1 , "{FF0000}(INFO) You have been kicked for not logging in !");
SetTimerEx("OnPlayerKicked", 100, false, "i", playerid);
}
if(response)
{//then
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
if(!strcmp(hashpass,pInfo[playerid][Pass]))
{//then
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
SetPlayerScore(playerid,pInfo[playerid][Score]);
SendClientMessage(playerid,-1,"{c3c3c3}(INFO) You have successfully logged in! You can start playing now.");
TogglePlayerSpectating(playerid, 0);
}
else
{//then
SendClientMessage(playerid, -1 , "{FF0000}(INFO) You didn't entered any password or you entered wrong password, for security purposes you must relog ! ");
SetTimerEx("OnPlayerKicked", 100, false, "i", playerid);
return 1;
}
}
}
Hosting is windows, since the plugins loaded are .dll and not .so
Directory permissions 777 on the Users Folder.