Two Small Problems
#9

THANKS, would you be able to do the same with the login command please:

pawn Код:
if(strcmp(cmd, "/login", true) == 0)
    {
    if(ReqClass[playerid] != 0)
    {
        SendClientMessage(playerid, COLOUR_RED, "You Can Only Login After The Class Selection!");
        return 1;
    }
    if(Logged[playerid] == 1)
    {
        SendClientMessage(playerid, COLOUR_RED, "You Are Already Logged In!");
        return 1;
    }

    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, COLOUR_YELLOW, "USAGE: /login [password]");
    }
    else
    {
    if (dini_Exists(udb_encode(PlayerName)))
    {
        tmp2 = dini_Get(udb_encode(PlayerName), "Password");
        if (udb_hash(tmp) != strval(tmp2))
        {
            SendClientMessage(playerid, COLOUR_RED, "Wrong/Invalid Password!");
        }
        else
        {
            Logged[playerid] = 1;
            Money[playerid] = dini_Int(udb_encode(PlayerName), "Money");
            AdminLevel[playerid] = dini_Int(udb_encode(PlayerName), "AdminLevel");
            TruckType[playerid] = dini_Int(udb_encode(PlayerName), "TruckType");
            JobsDone[playerid] = dini_Int(udb_encode(PlayerName), "JobsDone");
            JobLevel[playerid] = dini_Int(udb_encode(PlayerName), "JobLevel");
            Mission[playerid] = dini_Int(udb_encode(PlayerName), "Mission");
            format(string, sizeof(string), "%s, You Are Now Logged In. You Are Admin Level %d And Have $%d", PlayerName, AdminLevel[playerid], Money[playerid]);
            SendClientMessage(playerid, COLOUR_LIGHTBLUE, string);
            new Stats[128];
            format(Stats, sizeof(Stats), "[STATS] Job Level: %d | Truck ID: %d | Jobs Finished: %d | Mission Number: %d", JobLevel[playerid], TruckType[playerid], JobsDone[playerid], Mission[playerid]);
            SendClientMessage(playerid, COLOUR_GREEN, Stats);
            GivePlayerMoney(playerid, Money[playerid]);
            TruckerSkin[playerid] = dini_Int(udb_encode(PlayerName), "Skin");
            SetPlayerSkin(playerid,TruckerSkin[playerid]);
        }
    }
    else
    {
    format(string, sizeof(string), "You Are Not Registered. Type /register [password] To Create An Account!", PlayerName);
    SendClientMessage(playerid, COLOUR_RED, string);
    }
    }
    return 1;
}
Reply


Messages In This Thread
Two Small Problems - by Alec24 - 05.04.2009, 09:59
Re: Two Small Problems - by Torekk - 05.04.2009, 10:14
Re: Two Small Problems - by Alec24 - 05.04.2009, 10:19
Re: Two Small Problems - by LarzI - 05.04.2009, 12:01
Re: Two Small Problems - by Alec24 - 05.04.2009, 14:35
Re: Two Small Problems - by LarzI - 08.04.2009, 00:53
Re: Two Small Problems - by Alec24 - 09.04.2009, 11:42
Re: Two Small Problems - by Nero_3D - 09.04.2009, 12:05
Re: Two Small Problems - by Alec24 - 09.04.2009, 12:30
Re: Two Small Problems - by Nero_3D - 09.04.2009, 13:26

Forum Jump:


Users browsing this thread: 2 Guest(s)