Help me, EASY FIX...
#1

hey guys... I've got this issue, it's a simple login/register system, and to the other params such as score, kills and such I wan't to save the skin and position as well is that possible? I've tried to add the Skin saving but it isn't writing/reading from the file...
Here's the login cmd

Код:
cmd_login(playerid, params[])
{
    new file[256];
    new string[256], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(file, sizeof(string), "\\Users\\%s.ini", pname);
    if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /login [password]");
    if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_RED, "You are not registered!");
    if(logged[playerid]) return SendClientMessage(playerid, COLOR_RED, "You are already logged in!");
    new tmp[256];
    tmp = dini_Get(file, "hashPW");
    if(udb_hash(params) != strval(tmp)) 
    {
        format(string, 256, "You specified the wrong password for %s!", pname);
        SendClientMessage(playerid, COLOR_RED, string);
    }
    else
    {
        logged[playerid] = 1;
        SetPlayerSkin(playerid, dini_Int(file, "skin")-SetPlayerSkin(playerid));
		SetPlayerSkin(playerid, dini_Int(file, "score")-SetPlayerSkin(playerid));
		GivePlayerMoney(playerid, dini_Int(file, "money")-GetPlayerMoney(playerid));
        SendClientMessage(playerid, COLOR_YELLOW, "You have succesfully logged in!");
        printf("%s (%i) logged in with password %s", pname, playerid, params);
    }
    return 1;
Reply
#2

you don't need a command. with cmd_login you are creating a /login command. i think you have to add all this text in OnPlayerConnect
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)