Need a bit of help at Dini.
#1

Allright, so Me and a Friend, is doing this Stunting server together, and for some reason, it doesnt Save the files when you exit the server, nor does it read it apparently, when you log in, or maybe it's just one of them, i just dont get it... can anyone take a look at the code and see if there is anything wrong?... Thanks.

REGISTER:

Код:
dcmd_register(playerid, params[])
{
  new file[256], pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pName, sizeof(pName));
  format(file, sizeof(file), "%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_IntSet(file, "Admin", 0);
  dini_IntSet(file, "Score", GetPlayerScore(playerid));
  dini_IntSet(file, "Money", GetPlayerMoney(playerid));
  new string[128];
  format(string, sizeof(string), "You succesfully registered the nickname %s", pName);
  SendClientMessage(playerid, COLOR_YELLOW, string);
  IsPlayerLoggedIn[playerid] = 1;
  SendClientMessage(playerid, COLOR_YELLOW, "You have been automatically Logged in!");
  return true;
}
LOGIN:
Код:
dcmd_login(playerid, params[])
{
  new file[256];
  new string[128], pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pName, sizeof(pName));
  format(file, sizeof(string), "%s.ini", pName);
  if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /login [Password]");
  if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_RED, "You are not registered!");
  if(IsPlayerLoggedIn[playerid]) return SendClientMessage(playerid, COLOR_RED, "You are already Logged in!");
  new tmp[256];
  tmp = dini_Get(file, "HashPW");
  if(udb_hash(params) != strval(tmp))
  {
    format(string, sizeof(string), "You specified the wrong Password for %s!", pName);
    SendClientMessage(playerid, COLOR_RED, string);
  }
  else
  {
    IsPlayerLoggedIn[playerid] = 1;
    IsPlayerAdminX[playerid] = dini_Int(file, "Admin");
    GivePlayerMoney(playerid,dini_Int(file, "Money")-GetPlayerMoney(playerid));
    SetPlayerScore(playerid,dini_Int(file, "Score")-GetPlayerScore(playerid));
    SendClientMessage(playerid, COLOR_GREEN, "You have succesfully Logged in!");
    printf("%s (%i) Logged in.", pName, playerid);
  }
  return true;
}
DISCONNECT
Код:
public OnPlayerDisconnect(playerid, reason)
{
  new pName[MAX_PLAYER_NAME], string[128], file[256];
  format(file, sizeof(file), "%s.ini", pName);
  if (IsPlayerLoggedIn[playerid])
  {
  	dini_IntSet(file, "Score", GetPlayerScore(playerid));
  	dini_IntSet(file, "Money", GetPlayerMoney(playerid));
  }
  GetPlayerName(playerid, pName, sizeof(pName));
	switch(reason)
 	{
    case 0: format(string, sizeof(string), "%s has left the United Stunting Alliance server. (Lost Connection)", pName);
    case 1: format(string, sizeof(string), "%s has left the United Stunting Alliance server. (Leaving)", pName);
    case 2: format(string, sizeof(string), "%s has left the United Stunting Alliance server. (Kicked/Banned)", pName);
  }
  SendClientMessageToAll(COLOR_RED, string);
  printf(string);
  return true;
}
Reply


Messages In This Thread
Need a bit of help at Dini. - by shitbird - 03.05.2009, 18:34
Re: Need a bit of help at Dini. - by HB - 03.05.2009, 18:38
Re: Need a bit of help at Dini. - by shitbird - 03.05.2009, 18:39
Re: Need a bit of help at Dini. - by HB - 03.05.2009, 18:42
Re: Need a bit of help at Dini. - by Andom - 04.05.2009, 07:09
Re: Need a bit of help at Dini. - by DracoBlue - 04.05.2009, 08:07
Re: Need a bit of help at Dini. - by shitbird - 04.05.2009, 11:14
Re: Need a bit of help at Dini. - by Think - 04.05.2009, 11:17
Re: Need a bit of help at Dini. - by DracoBlue - 04.05.2009, 11:27
Re: Need a bit of help at Dini. - by pen_theGun - 04.05.2009, 11:54

Forum Jump:


Users browsing this thread: 1 Guest(s)