how would i save this?
#6

You should save everything at once, instead of using dUserSetINT many times over and over.
Here's the tutorial.
pawn Код:
dcmd_register(playerid, params[])
{
  new file[128], pname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  format(file, sizeof(file), "\\Users\\%s.ini", pname);
  if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE:/register [password]");
  if(dini_Exists(file)) return SendClientMessage(playerid, COLOR_RED, "You are already registered!");
  dini_Create(file);
  dini_IntSet(file, "hashPW", udb_hash(params));
  dini_Set(file, "password", params);
  dini_IntSet(file, "level", 0);
  dini_IntSet(file, "score", GetPlayerScore(playerid));
  dini_IntSet(file, "money", GetPlayerMoney(playerid));
  new string[128];
  format(string, 128, "You succesfully registered the nickname %s with password %s", pname, params);
  SendClientMessage(playerid, COLOR_YELLOW, string);
  logged[playerid] = 1;
  SendClientMessage(playerid, COLOR_YELLOW, "You have been automatically logged in!");
  return 1;
}
I'd rather use OnPlayerDisconnect public though, so it automatically saves whenever you leave.
Reply


Messages In This Thread
how would i save this? - by Lethaal - 22.02.2011, 17:07
Re: how would i save this? - by Anteino - 22.02.2011, 17:15
Re: how would i save this? - by Lethaal - 22.02.2011, 17:17
Re: how would i save this? - by maramizo - 22.02.2011, 17:20
Re: how would i save this? - by Lethaal - 22.02.2011, 17:23
Re: how would i save this? - by maramizo - 22.02.2011, 17:28
Re: how would i save this? - by Lethaal - 22.02.2011, 17:51
Re: how would i save this? - by maramizo - 22.02.2011, 18:14
Re: how would i save this? - by Lethaal - 22.02.2011, 18:46
Re: how would i save this? - by maramizo - 22.02.2011, 18:58
Re: how would i save this? - by Lethaal - 22.02.2011, 19:30
Re: how would i save this? - by Lethaal - 23.02.2011, 08:13
Re: how would i save this? - by Lethaal - 23.02.2011, 12:45
Re: how would i save this? - by MadeMan - 23.02.2011, 12:49
Re: how would i save this? - by Lethaal - 23.02.2011, 12:51
Re: how would i save this? - by [$A$]W33D$P33D - 22.04.2011, 15:08

Forum Jump:


Users browsing this thread: 9 Guest(s)