Problem in Dialog Login
#1

Guys here is my Login dialog it have a problem when player disconnect from the server the server saves the player skin so in dialog i set when player login again it should spawn with that skin which saves on disconnect but in this dialog when player login its setting player skin 7 here is the code


here is the code of disconnect
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(GMX[playerid] == 1)
    {
    GetPlayerPos(playerid,PlayerInfo[playerid][TutX],PlayerInfo[playerid][TutY],PlayerInfo[playerid][TutZ]);
    dini_IntSet(Pos(playerid),"Skin",GetPlayerSkin(playerid));
    }
    else
    {
    GetPlayerPos(playerid,PlayerInfo[playerid][SpawnX],PlayerInfo[playerid][SpawnY],PlayerInfo[playerid][SpawnZ]);
    dini_IntSet(Pos(playerid),"Skin",GetPlayerSkin(playerid));
    }
    getdate(PlayerInfo[playerid][Year], PlayerInfo[playerid][Month], PlayerInfo[playerid][Day]);
    if(IsLogged[playerid] == 1)
    {
        SStats(playerid);
        dini_IntSet(Pos(playerid),"Skin",GetPlayerSkin(playerid));
    }
    new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    switch(reason)
    {
        case 0: format(string, sizeof(string), "**{FF0000}%s has left the server. (TimeOut)", pname);
        case 1: format(string, sizeof(string), "**{FF0000}%s has left the server.", pname);
        case 2: return 0;
    }
    new vehicleid = GetPlayerVehicleID(playerid);
    if(IsOwner[playerid]==1)
    {
     if(PlayerInfo[playerid][AL] == 1)
     {
        PlayerInfo[playerid][Lock] = 1;
        if(vehicleid == PlayerInfo[playerid][Car])
        {
          for(new i=0; i < MAX_PLAYERS; i++)
          {
            SetVehicleParamsForPlayer(PlayerInfo[playerid][Car],i,0,1);
          }
        }
      }
    }
    TextDrawHideForPlayer(playerid, Time2);
    aid[playerid] = -1;
    IsLogged[playerid] = 0;
    PlayerInfo[playerid][Neon] = 0;
    GoToLvCP[playerid] = 0;
    GoToSfCP[playerid] = 0;
    PlayerInfo[playerid][God] = 0;
    PlayerInfo[playerid][GodCar] = 0;
    GoToLsCP[playerid] = 0;
    onduty[playerid] = 0;
    RPMode[playerid] = 0;
    DestroyVehicle(ac[playerid]);
    dini_IntSet(Pos(playerid),"Skin",GetPlayerSkin(playerid));
//  KillTimer(OnlineTimer[playerid]);
    KillTimer(MuteTimer[playerid]);
    SendClientMessageToAll(COLOR_RED, string);
    //InGSFZone1Already[playerid] = false;
    //InGSFZone2Already[playerid] = false;
    //InGSFZone3Already[playerid] = false;
    //InGSFZone4Already[playerid] = false;

    /*InRHBZone1Already[playerid] = false;
    InRHBZone2Already[playerid] = false;
    InRHBZone3Already[playerid] = false;
    */


    /*InLAZone1Already[playerid]  = false;
    InLAZone2Already[playerid]  = false;
    InLAZone3Already[playerid]  = false;
    InLAZone4Already[playerid]  = false;*/


    InMFZone1Already[playerid]  = false;
    InMFZone2Already[playerid]  = false;
    InMFZone3Already[playerid]  = false;
    InMFZone4Already[playerid]  = false;
    InESBZone1Already[playerid] = false;
    InESBZone2Already[playerid] = false;
    InESBZone3Already[playerid] = false;
    InESBZone4Already[playerid] = false;
    return 1;
}
code for Login

pawn Код:
if (dialogid == LOGIN)
    {
      new name[MAX_PLAYER_NAME], str1[128],str2[128],string[160], tmp=dini_Int(Pos(playerid), "Password");
      if(!response)
      {
      SendClientMessage(playerid,COLOR_WHITE,"You can login using /login [password]");
      SetupPlayerForClassSelection(playerid);
      SetPlayerVirtualWorld(playerid,0);
      return 1;
      }
      GetPlayerName(playerid, name, sizeof(name));
      format(str1, 128, "{FFFFFF}Welcome to "#SERVER_NAME"\n\n{DDCA22}Account:{FFFFFF} %s\n\nPlease Enter Your Password Below", name);
      SetPlayerVirtualWorld(playerid,0);
      if (!strlen(inputtext)) return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login Account",str1, "Login", "");
      if(udb_hash(inputtext) == tmp)
      {
        LoadStats(playerid);
        IsLogged[playerid] = 1;
        PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
        format(str2,sizeof(str2),"Welcome %s, your stats have been successfully restored!", name);
        SendClientMessage(playerid,COLOR_WHITE,str2);
        SetPlayerVirtualWorld(playerid,0);
        SetPlayerInterior(playerid, 0);
        SetPlayerSkin(playerid,dini_Int(Pos(playerid),"Skin"));
        SetSpawnInfo(playerid,0,dini_Int(Pos(playerid),"Skin"),dini_Int(Pos(playerid), "X1"),dini_Int(Pos(playerid), "Y1"), dini_Int(Pos(playerid), "Z1"),0, 0, 0, 0, 0, 0, 0 );
        SpawnPlayer(playerid);
        PlayerConnect(playerid);
        if(GetPlayerScore(playerid) >=1)
        {
        format(string,sizeof(string),"{10F441}Experience Level: {FFFFFF}%d", GetPlayerScore(playerid));
        SendClientMessage(playerid, COLOR_WHITE, string);
        }
        else
        {
        format(string,sizeof(string),"{FF6347}Experience:\tNo experience at the moment.");
        SendClientMessage(playerid, COLOR_WHITE, string);
        }

        if(GetPlayerBusinessID(playerid) != -1)
        {
            format(File,sizeof(File),"%i.ini",GetPlayerBusinessID(playerid));
            format(str1,sizeof(str1),"Business Name: {FFFFFF}'%s'",dini_Get(File, "Name"));
            SendClientMessage(playerid,COLOR_YELLOW, str1);
        }
        if(PlayerInfo[playerid][VIP]>= 1)
        {
            new mode[128],str[256];
            if(PlayerInfo[playerid][VIP]==1)
            {mode = "{FFFF00}Silver Premium Account";}
            if(PlayerInfo[playerid][VIP]==2)
            {mode = "{0000BB}Golden Premium Account";}
            if(PlayerInfo[playerid][VIP]==3)
            {mode = "{ADFF2F}Luxury Premium Account";}
            format(str,sizeof(str),"Account Status : %s",mode);
            SendClientMessage(playerid,-1,str);
        }
        if(strcmp(dini_Get(Pos(playerid),"Org"), " ", true) == 0){SendClientMessage(playerid, COLOR_SAMP, "Organization: {A9C4E4}None.");}
        else
        {
            format(string,sizeof(string),"Organization: {A9C4E4}%s.",RPONEx(playerid));
            SendClientMessage(playerid, COLOR_SAMP, string);
        }
        }
        else
        {
            new kname[MAX_PLAYER_NAME];
            GetPlayerName(playerid,kname,sizeof(kname));
            gPlayerLogTries[playerid] += 1;
            SendClientMessage(playerid,COLOR_WHITE, "SERVER: Wrong password, 1 try left.");
            format(str1, 128, "{A9C4E4}Welcome to "#SERVER_NAME"\n\n{A9C4E4}Account:{A9C4E4} %s\n\nPlease Enter Your Password Below", kname);
            ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login Account", str1, "Login", "");
            SetupPlayerForClassSelection(playerid);
            SetPlayerVirtualWorld(playerid,0);
            if(gPlayerLogTries[playerid] == 2)
            {
             Kick(playerid);
            }
        }
      return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)