/login Help
#1

Код:
dcmd_login(playerid, params[])
{
  if(playerinfo[playerid][login])
  {
    SendClientMessage(playerid, COLOR_RED, "Error: You are already logged in!");
    return 1;
  }
  if(!strlen(params))
  {
    SendClientMessage(playerid,COLOR_GREY,"USAGE: /login [password]");
    return 1;
  }
  if(playerinfo[playerid][uid]==-1)
  {
    return SendClientMessage(playerid,COLOR_GREY,"Please, register first!");
  }
  format(stringEX,MAX_STRING1,"`id`='%d'",playerinfo[playerid][uid]);
  mysql_GetStr("users","pass",stringEX);
  if(!strcmp(String,params,false))
  {
    format(stringEX,MAX_STRING1,"Welcome back %s!",playerinfo[playerid][playername]);
    SendClientMessage(playerid,COLOR_LIGHTYELLOW,stringEX);
    LoadFromMysql(playerid);
    playerinfo[playerid][login]=4*60;
    playerinfo[playerid][updatereduce]=30;
    getdate(yearEX,monthEX,dayEX);
    gettime(hourEX,minEX,secEX);
    format(queryEX, 256, "UPDATE `users` SET `timestamp`='%d/%d/%d - %d:%d:%d' WHERE `id`='%d' LIMIT 1;",yearEX,monthEX,dayEX,hourEX,minEX,secEX,playerinfo[playerid][uid]);
    mysql_query(queryEX);
    for(new i = 0; i < MAX_PLAYERS+1; i++)
    {
      if(IsPlayerConnected(i))
      {
        if(IsPlayerInAnyVehicle(i))
        {
          if(tints[GetPlayerVehicleID(i)])
          {
            if(!playerinfo[playerid][admin])
            {
              ShowPlayerNameTagForPlayer(playerid, i, 0);
            }
            else
            {
              SetPlayerMarkerForPlayer(playerid, i, COLOR_BLUE);
            }
          }
        }
      }
    }
    TogglePlayerSpectating(playerid, 0);
    AntiHax[playerid][TpX] = 0;
    AntiHax[playerid][TpY] = 0;
    AntiHax[playerid][TpZ] = 0;
    SetSpawnInfo(playerid, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
    SpawnPlayer(playerid);
    AntiHax[playerid][TpX] = 0;
    AntiHax[playerid][TpY] = 0;
    AntiHax[playerid][TpZ] = 0;

    SetPlayerSkin(playerid,playerinfo[playerid][skin]);
    SetPlayerScore(playerid,1);
    return 1;
  }
  else
  {
    playerinfo[playerid][Try]++;
    format(stringEX,MAX_STRING1,"Wrong password (%d/3)!",playerinfo[playerid][Try]);
    SendClientMessage(playerid,COLOR_RED,stringEX);
    if(playerinfo[playerid][Try]==3)
    {
      SendClientMessage(playerid,COLOR_RED,"You have tried three times. You have been kicked from the server.");
      Kick(playerid);
    }
    return 1;
  }
}
Main error were having is anything over id 0 cant login even if the pw is right and after id 0 logs out then back in it doesnt work we tried this with many accounts.
Reply
#2

Yea we could use some help with this xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)