[Pomoc]login-register

Započeo ‹Fox›, Decembar 19, 2010, 19:02:22 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Udem u server registriram se i odem relog...i kad ulazim u igru opet mi otvori dialog za register a ne za login
Evo sistema:

public OnPlayerConnect(playerid)
{
if(register[playerid] == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "Dobrodosli na Multy DeathMatch/Race/stunt server !");
ShowPlayerDialog(playerid, login, DIALOG_STYLE_INPUT, "login", "Vase ime je registrirano! Molimo vas da unesete vasu lozinku!", "dalje", "odustani");
}
else
{
SendClientMessage(playerid, COLOR_GREEN, "Za pregled vaseg statusa upisite /stats");
SendClientMessage(playerid, COLOR_GREEN, "Za pregled statusa drugog igraca upisite /statsp [ID]");
SendClientMessage(playerid, COLOR_YELLOW, "Dobrodosli na Multy DeathMatch/Race/stunt server !");
ShowPlayerDialog(playerid, reg, DIALOG_STYLE_INPUT, "register", "Vase ime nije registrirano! Molimo vas da se registrirate", "dalje", "odustani");
}
return 1;
}

dialog response...:
   if(dialogid == reg)
   {
      if(response)
      {
          new string[128];
          new name[MAX_PLAYER_NAME];
         GetPlayerName(playerid, name, sizeof(name));
         if(strlen(inputtext) == 0)
         {
            format(string, sizeof string, "Vase ime nije registrirano! Molimo vas da se registrirate", name);
            ShowPlayerDialog(playerid, reg, DIALOG_STYLE_INPUT, "Registracija", string, "Register!", "Odustani.");
   GivePlayerMoney(playerid, 2200);
            return 0;
         }
         if(!fexist(file))
         {
format(file,sizeof(file),"%s.ini",name);
            dini_Create(file);
register[playerid] = 1;
            PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
            register2[playerid] = 1;
                  dini_IntSet(file,"Score", GetPlayerScore(playerid));
            dini_IntSet(file,"Deaths",deaths[playerid]);
            dini_IntSet(file,"money", GetPlayerMoney(playerid));
             dini_IntSet(file,"Kills", kills[playerid]);
             dini_IntSet(file,"AdminLevel", admlvl[playerid]);
             dini_IntSet(file, "Leader", mafialeader[playerid]);
             dini_IntSet(file, "mafia", mafia[playerid]);
            dini_IntSet(file,"Password", udb_hash(inputtext));
         }
      }
      return 1;
   }
      if(dialogid == login)
   {
      if(response)
      {
          new string[128];
          new PlayerName[24];
         if(strlen(inputtext) == 0)
         {
             GetPlayerName(playerid, PlayerName, sizeof PlayerName);
             format(string, sizeof string, "Upisite lozinku \n\nDobrodosli %s! \nRegistrirani ste ! molimo da se ulogirate!!", PlayerName);
            ShowPlayerDialog(playerid, login, DIALOG_STYLE_INPUT, "Login", string, "Login!", "Odustani.");
            return 0;
         }
         new name[MAX_PLAYER_NAME];
         GetPlayerName(playerid, name, sizeof(name));
         format(file,sizeof(file),"%s.ini",name);
         if(fexist(file))
         {
             new password = dini_Int(file, "Password");
                if(udb_hash(inputtext) != password)
            {
            SendClientMessage(playerid, COLOR_RED, "Pogrijesili ste lozinku!");
                 GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
                 printf("%s has failed to login", name);
                 Kick(playerid);
            }
            else
            {
            autospawn[playerid] = 1;
            SetTimer("autospawn2", 10000, false);
               IsLogged[playerid] = 1;
               ResetPlayerMoney(playerid);
               SetPlayerScore(playerid, dini_Int(file,"Score"));
               admlvl[playerid] = dini_Int(file, "AdminLevel");
               GivePlayerMoney(playerid, dini_Int(file,"Money"));
               deaths[playerid] = dini_Int(file,"Deaths");
               kills[playerid] = dini_Int(file,"Kills");
               mafia[playerid] = dini_Int(file,"mafia");
               mafialeader[playerid] = dini_Int(file,"Leader");
               TogglePlayerSpectating(playerid, 0);
            }
         }
      }
   }




public OnPlayerDisconnect(playerid, reason)
{
            dini_IntSet(file,"Score", GetPlayerScore(playerid));
            dini_IntSet(file,"Deaths",deaths[playerid]);
            dini_IntSet(file,"money", GetPlayerMoney(playerid));
             dini_IntSet(file,"Kills", kills[playerid]);
             dini_IntSet(file,"AdminLevel", admlvl[playerid]);
             dini_IntSet(file, "mafia", mafia[playerid]);
             dini_IntSet(file, "Leader", mafialeader[playerid]);
return 1;
}