Register & Login Bug
#1

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    new string[1024];
    if(IsPlayerNPC(playerid))
    {
        SpawnPlayer(playerid);
        return 1;
    }
    //PlayerPlaySound(playerid, 1076, 0.0, 0.0, 0.0);
    PlayerInfo[playerid][pModel] = Peds[classid][0];
    MedicBill[playerid] = 0;
    SetPlayerCameraPos(playerid, 1602.2902,-1675.1558,82.6906);
    SetPlayerCameraLookAt(playerid, 1604.6466,-1458.1382,92.7876);
    TextDrawHideForPlayer(playerid, Textdraw2011);
    TextDrawHideForPlayer(playerid, Textdraw2012);
    if (gPlayerAccount[playerid] != 0)
    {
        gPlayerAccount[playerid] = 1;
        new loginstring[128];
        new loginname[64];
        SCM(playerid, COLOR_GREY, " ");
        SCM(playerid, COLOR_GREY, " ");
        if(IsPlayerNPC(playerid)) return 1;
        MedicBill[playerid] = 0;
        GetPlayerName(playerid,loginname,sizeof(loginname));
        format(loginstring,sizeof(loginstring),"{FFFFFF}Welcome back to Roleplay, "color_green"%s\n{FFFFFF}this account is registered.\nPlease login:",loginname);
        ShowPlayerDialog(playerid,12346,DIALOG_STYLE_PASSWORD," ",loginstring,"Login","Cancel");
    }
    else
    {
        gPlayerAccount[playerid] = 0;
        new regstring[128];
        MedicBill[playerid] = 0;
        new regname[64];
        SCM(playerid, COLOR_GREY, " ");
        SCM(playerid, COLOR_GREY, " ");
        SCM(playerid, COLOR_GREY, " ");
        SCM(playerid, COLOR_GREY, " ");
        SCM(playerid, COLOR_GREY, " ");
        SCM(playerid, COLOR_GREY, " ");
        SCM(playerid, COLOR_GREY, " ");
        SCM(playerid, COLOR_GREY, " ");
        SCM(playerid, COLOR_GREY, " ");
        SCM(playerid, COLOR_GREY, " ");
        if(IsPlayerNPC(playerid)) return 1;
        GetPlayerName(playerid,regname,sizeof(regname));
        format(regstring,sizeof(regstring),""color_white"Welcome to Roleplay, "color_red"%s\n"color_white"this account is not registered.\n"color_white"Please register:",regname);
        ShowPlayerDialog(playerid,12345,DIALOG_STYLE_PASSWORD," ",regstring,"Register","Cancel");
    }
    new y, m, d;
    new h,mi,s;
    getdate(y,m,d);
    gettime(h,mi,s);
    LoginLog(string);
    return 1;
}
I already register, but if I relog. why it says register again?
what is wrong with this code
Reply
#2

can you show us the onplayerdisconnect, or the saving part please?
Reply
#3

This is Newport City Roleplay script ..
Reply
#4

Yeah, but i am not going to download the whole thing to view it
if you just post the code, all scripters/helping people can help you
Reply
#5

I thing you have to make or search for code that write and read the name and pass.Look at this tutorial https://sampforum.blast.hk/showthread.php?tid=273088.Go to step VI and VII.
Reply
#6

Quote:
Originally Posted by Jari_Johnson*
Посмотреть сообщение
Yeah, but i am not going to download the whole thing to view it
if you just post the code, all scripters/helping people can help you
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new sendername[MAX_PLAYER_NAME];
    new string[256];
    if(VipInfo[playerid][vCar] != -1) CarDeleter(VipInfo[playerid][vCar]);
    TextDrawHideForPlayer(playerid, TextdrawCeas3);
    TextDrawHideForPlayer(playerid, TextdrawCeas4);
    TextDrawHideForPlayer(playerid, TextdrawCeas5);
    TextDrawHideForPlayer(playerid, TextdrawCeas6);
    TextDrawHideForPlayer(playerid, TextdrawCeas0);
    TextDrawHideForPlayer(playerid, TextdrawCeas1);
    TextDrawHideForPlayer(playerid, TextdrawCeas2);
    TextDrawHideForPlayer(playerid, Ora);
    TextDrawHideForPlayer(playerid, Zile);
    TextDrawHideForPlayer(playerid, Secunde);
    TextDrawHideForPlayer(playerid, DataCurenta);
    Delete3DTextLabel(Gold[playerid]);
    Delete3DTextLabel(Premium[playerid]);
    Delete3DTextLabel(Silver[playerid]);
    TextDrawDestroy(Nume[playerid]);
    BowlingMinutes[playerid] = 0;
    BowlingSeconds[playerid] = 0;
    BowlingStatus[playerid] = F_BOWLING_THROW;
    PinsLeft[1][playerid] = 0;
    AbleToPlay[playerid] = 0;
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    for(new pls;pls <= MAX_PLAYERS;pls++)
    {
        if(NoJoinLeavemsg[pls] == 0)
        {
            switch(reason)
            {
                case 0: format(string,sizeof string,"%s left the server. (Crashed)",name);
                case 1: format(string,sizeof string,"%s left the server. (Leaving)",name);
                case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
            }
            SendClientMessage(pls,COLOR_GREY,string);
        }
    }
    if(PlayerInfo[playerid][pRdeath] == 1)
    {
    SetCameraBehindPlayer(playerid);
    TogglePlayerControllable(playerid, 1);
    MoveObject(repair1, 2137.5932617188, -2049.2260742188, 2275.69921875,1);
    Update3DTextLabelText(Text3D: ocupat[0], COLOR_WHITE, ""color_yellow"[ "color_white"Parking 1 "color_yellow"]\n"color_green"["color_white" Open "color_green"]");
    }
    if(PlayerInfo[playerid][pRdeath] == 2)
    {
    SetCameraBehindPlayer(playerid);
    TogglePlayerControllable(playerid, 1);
    Update3DTextLabelText(Text3D: ocupat[1], COLOR_WHITE, ""color_yellow"[ "color_white"Parking 2 "color_yellow"]\n"color_green"["color_white" Open "color_green"]");
    MoveObject(repair2, 2141.9343261719, -2049.2463378906, 2275.6193847656,1);
    }
    if(PlayerInfo[playerid][pRdeath] == 3)
    {
    SetCameraBehindPlayer(playerid);
    TogglePlayerControllable(playerid, 1);
    Update3DTextLabelText(Text3D: ocupat[2], COLOR_WHITE, ""color_yellow"[ "color_white"Parking 3 "color_yellow"]\n"color_green"["color_white" Open "color_green"]");
    MoveObject(repair3, 2145.953125, -2049.2514648438, 2275.7509765625,1);
    }
    if(PlayerInfo[playerid][pRdeath] == 4)
    {
    SetCameraBehindPlayer(playerid);
    TogglePlayerControllable(playerid, 1);
    Update3DTextLabelText(Text3D: ocupat[3], COLOR_WHITE, ""color_yellow"[ "color_white"Parking 4 "color_yellow"]\n"color_green"["color_white" Open "color_green"]");
    MoveObject(repair4, 2150.8181152344, -2049.4018554688, 2275.763671875,1);
    }
    if(TextdrawActive[playerid] == 1)
    {
        TextDrawHideForPlayer(playerid, TextDrawsw1[playerid]);
        TextDrawDestroy(TextDrawsw1[playerid]);
    }
    KillTimer(BowlingTimer[PlayersBowlingRoad[playerid]]);
    BowlingRoadStatus[PlayersBowlingRoad[playerid]] = ROAD_EMPTY;
    if(PlayersBowlingRoad[playerid]==0)
    {
        UpdateDynamic3DTextLabelText(BowlingRoadScreen[0], 0xFFFFFF,"{008800}[{FFFFFF} Road 1{008800} ]\n Empty");
        DestroyPins(0);
    }
    else if(PlayersBowlingRoad[playerid]==1)
    {
        UpdateDynamic3DTextLabelText(BowlingRoadScreen[1], 0xFFFFFF,"{008800}[{FFFFFF} Road 2{008800} ]\n Empty");
        DestroyPins(1);
    }
    else if(PlayersBowlingRoad[playerid]==2)
    {
        UpdateDynamic3DTextLabelText(BowlingRoadScreen[2], 0xFFFFFF,"{008800}[{FFFFFF} Road 3{008800} ]\n Empty");
        DestroyPins(2);
    }
    else if(PlayersBowlingRoad[playerid]==3)
    {
        UpdateDynamic3DTextLabelText(BowlingRoadScreen[3], 0xFFFFFF,"{008800}[{FFFFFF} Road 4{008800} ]\n Empty");
        DestroyPins(3);
    }
    else if(PlayersBowlingRoad[playerid]==4)
    {
        UpdateDynamic3DTextLabelText(BowlingRoadScreen[4], 0xFFFFFF,"{008800}[{FFFFFF} Road 5{008800} ]\n Empty");
        DestroyPins(4);
    }
    PlayersBowlingRoad[playerid] = ROAD_NONE;
    gActivePlayers[playerid]--;
    numplayers--;
    PlayerInfo[playerid][pAdjustable] = 1;
    MedicBill[playerid] = 0;
    MedicBill[playerid] = 0;
    MedicBill[playerid] = 0;
    OnPlayerUpdate(playerid);
    KillTimer(BlinkTime[playerid]);
    new playername2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    new y, m, d;
    new h,mi,s;
    getdate(y,m,d);
    gettime(h,mi,s);
    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s s-a deconectat.",d,m,y,h,mi,s,playername2);
    QuitLog(string);
    if(gTeam[playerid] == 2 && IsACop(playerid))
    {
        for(new i = 0; i<MAX_PLAYERS;i++)
        {
            new wanted = WantedLevel[playerid];
            if(wanted > 0)
            {
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string,128, "* %s has quited the game having Wanted Level[%d] (Quit).",sendername,wanted);
                PBroadCast(COLOR_BLUE,string,1);
            }
        }
    }

    if (PlayerInfo[playerid][pLevel] >= 1)
    {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "%s has exited the game.",sendername);
        SCMTA(COLOR_LIGHTRED, string);
    }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(TaxiAccepted[i] < 999)
            {
                if(TaxiAccepted[i] == playerid)
                {
                    TaxiAccepted[i] = 999;
                    GameTextForPlayer(i, "~w~Taxi Caller~n~~r~Left the game", 5000, 1);
                    TaxiCallTime[i] = 0;
                    DisablePlayerCheckpoint(i);
                }
            }
            else if(BusAccepted[i] < 999)
            {
                if(BusAccepted[i] == playerid)
                {
                    BusAccepted[i] = 999;
                    GameTextForPlayer(i, "~w~Bus Caller~n~~r~Left the game", 5000, 1);
                    BusCallTime[i] = 0;
                    DisablePlayerCheckpoint(i);
                }
            }
        }
    }
    if(GettingCK[playerid] < 999)
    {
        if(IsPlayerConnected(GettingCK[playerid]))
        {
            SCM(GettingCK[playerid], COLOR_YELLOW, "Your Character Kill has left the server, try again later.");
            OnCK[GettingCK[playerid]] = 999;
        }
    }
    if(TransportCost[playerid] > 0 && TransportDriver[playerid] < 100)
    {
        if(IsPlayerConnected(TransportDriver[playerid]))
        {
            TransportMoney[TransportDriver[playerid]] += TransportCost[playerid];
            TransportTime[TransportDriver[playerid]] = 0;
            TransportCost[TransportDriver[playerid]] = 0;
            format(string, sizeof(string), "~w~Passenger left~n~~g~Earned $%d",TransportCost[playerid]);
            GameTextForPlayer(TransportDriver[playerid], string, 5000, 1);
        }
    }
    if(GotHit[playerid] > 0)
    {
        if(GetChased[playerid] < 999)
        {
            if(IsPlayerConnected(GetChased[playerid]))
            {
                SCM(GetChased[playerid], COLOR_YELLOW, "Your Hit has left the server.");
                GoChase[GetChased[playerid]] = 999;
            }
        }
    }
    if(PlayerPaintballing[playerid] != 0)
    {
        PaintballPlayers --;
    }
    if(PlayerKarting[playerid] > 0 && PlayerInKart[playerid] > 0)
    {
        KartingPlayers --;
    }
    if(PlayersChannel[playerid] < 999)
    {
        IRCInfo[PlayersChannel[playerid]][iPlayers] -= 1;
    }
    if(HireCar[playerid] != 299)
    {
        gLastDriver[HireCar[playerid]] = 300;
        gCarLock[HireCar[playerid]] = 0;
        UnLockCar(HireCar[playerid]);
    }
    if (gLastCar[playerid] > 0)
    {
        gLastDriver[gLastCar[playerid]] = 300;
        if(PlayerInfo[playerid][pPhousekey] != gLastCar[playerid]-1)
        {
            gCarLock[gLastCar[playerid]] = 0;
            UnLockCar(gLastCar[playerid]);
        }
    }
    if(PlayerBoxing[playerid] > 0)
    {
        if(Boxer1 == playerid)
        {
            if(IsPlayerConnected(Boxer2))
            {
                PlayerBoxing[Boxer2] = 0;
                SetPlayerPos(Boxer2, 765.8433,3.2924,1000.7186);
                SetPlayerInterior(Boxer2, 5);
                GameTextForPlayer(Boxer2, "~r~Match interupted", 5000, 1);
            }
        }
        else if(Boxer2 == playerid)
        {
            if(IsPlayerConnected(Boxer1))
            {
                PlayerBoxing[Boxer1] = 0;
                SetPlayerPos(Boxer1, 765.8433,3.2924,1000.7186);
                SetPlayerInterior(Boxer1, 5);
                GameTextForPlayer(Boxer1, "~r~Match interupted", 5000, 1);
            }
        }
        InRing = 0;
        RoundStarted = 0;
        Boxer1 = 255;
        Boxer2 = 255;
        TBoxer = 255;
    }
    if(TransportDuty[playerid] == 1)
    {
        TaxiDrivers -= 1;
    }
    else if(TransportDuty[playerid] == 2)
    {
        BusDrivers -= 1;
    }
    if(PlayerInfo[playerid][pJob] == 11)
    {
        if(JobDuty[playerid] == 1) { Medics -= 1; }
    }
    //else if(PlayerInfo[playerid][pJob] == 7)
    //{
//      if(JobDuty[playerid] == 1) { Mechanics -= 1; }
//  }
    OnPlayerUpdate(playerid);
    for(new pls;pls <= MAX_PLAYERS;pls++)
    {
        if(NoJoinLeavemsg[pls] == 0)
        {
            switch(reason)
            {
                case 0: format(string,sizeof string,"%s left the server. (Crashed)",name);
                case 1: format(string,sizeof string,"%s left the server. (Leaving)",name);
                case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
            }
            SendClientMessage(pls,COLOR_GREY,string);
        }
    }
}
Reply
#7

hmm, i can't find the part where things get saved here...
can you find and post the saving part for me please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)