SA-MP Forums Archive
[How to fix this bug ? ] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [How to fix this bug ? ] (/showthread.php?tid=598305)



[How to fix this bug ? ] - Raniti - 10.01.2016

Why When I Join my Server First sure i got Register But When I'm Relog i still get Register Why is not login??
Code :
Код:
// OnPlayerConnect
TogglePlayerSpectating(playerid,1);
new string[256], name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(string,256,"~r~Hello %s !",name);
GameTextForPlayer(playerid,string,10000,6);
format(string,256,"Players/%s.ini",name);
if(fexist(string))
{
 ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login","Welcome! Please Login!","Login","Exit");
}
else
{
 ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Register","Welcome! Please Register!","Register","Exit");
}

// ReadWrite Player Functions
ReadPlayer(line,playerid)
{
 new string[256],name[MAX_PLAYER_NAME];
 new File:player;
 GetPlayerName(playerid,name,sizeof(name));
 format(string,256,"Players/%s.ini",name);
 player = fopen(string, io_read);
 for(new i=1; i<=line; i++)
 {
  fread(player,string);
  if(line==i)
  {fclose(player); return string;}
 }
 return string;
}

WritePlayer(text[],playerid, bool:filestart)
{
 new string[256],name[MAX_PLAYER_NAME];
 new File:player;
 GetPlayerName(playerid,name,sizeof(name));
 format(string,256,"Players/%s.ini",name);
 player = fopen(string, io_append);
 if(filestart)
 {
  fwrite(player,text);
 }
 else
 {
  format(string,256,"\n%s",text);
  fwrite(player,string);
 }
 fclose(player);
}
there is a viled code??


Re: [How to fix this bug ? ] - Stanford - 10.01.2016

Can you provide us what you have under OnPlayerDialogResponse for the register dialog as the issue might be there.


Re: [How to fix this bug ? ] - Raniti - 10.01.2016

Where? I'm not find it ~! Bro i use my Server On Ultra-Host...


Re: [How to fix this bug ? ] - Raniti - 10.01.2016

heeelp me all plesae


Re: [How to fix this bug ? ] - AmigaBlizzard - 11.01.2016

When you register, does your playerfile actually exist?
If it doesn't exist, show the code under OnDialogResponse for the register window, so we can see why it doesn't get saved.