Register system bugg?
#1

Hello, when i do /register password

it say unknown command, but the server register the user but he say unknown command

pawn Код:
//REGISTER
if (strcmp(cmd, "/register", true)==0 || strcmp(cmd, "/regnick", true)==0)
    {
      tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GREY, "USAGE: /register [password]");
            return 1;
        }
        if (gPlayerLogged[playerid] == 1)
        {
            SendClientMessage(playerid, COLOR_RED, "SERVER: That nickname is already logged in.");
            return 1;
        }
        format(string, sizeof(string), "/userfiles/%s.user", playername);
        PlayerInfo[playerid][pPocket] = SPAWN_MONEY+playermoney;
        strmid(PlayerInfo[playerid][pPassword], tmp, 0, strlen(cmdtext), 32);
        new File: file = fopen(string, io_read);
        if (file)
        {
            SendClientMessage(playerid, COLOR_RED, "SERVER: That nickname is already in use, Reconnect with an other name");
            fclose(file);
            return 1;
        }
        new File:hFile;
        hFile = fopen(string, io_append);
        new var[32];
        format(var, 32, "%s\n", PlayerInfo[playerid][pPassword]);fwrite(hFile, var);
        format(var, 32, "%d pLevel\n", PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
        format(var, 32, "%d pExp\n", PlayerInfo[playerid][pExp]);fwrite(hFile, var);
        format(var, 32, "%d pHouseOwner\n", PlayerInfo[playerid][pHouseOwner]);fwrite(hFile, var);
        format(var, 32, "%d pAdmin\n", PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
        format(var, 32, "%d pVip\n", PlayerInfo[playerid][pVip]);fwrite(hFile, var);
        format(var, 32, "%d pBank\n", PlayerInfo[playerid][pBank]);fwrite(hFile, var);
        format(var, 32, "%d pPocket\n", PlayerInfo[playerid][pPocket]);fwrite(hFile, var);
        format(var, 32, "%d pHouseKey\n", PlayerInfo[playerid][pHouseKey]);fwrite(hFile, var);
        format(var, 32, "%d pPerMute\n", PlayerInfo[playerid][pPerMute]);fwrite(hFile, var);
        format(var, 32, "%d pJailedSec\n", PlayerInfo[playerid][pJailedSec]);fwrite(hFile, var);
        format(var, 32, "%d pKills\n", PlayerInfo[playerid][pKills]);fwrite(hFile, var);
        format(var, 32, "%d pDeaths\n", PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
        format(var, 32, "%d pLicenseA\n", PlayerInfo[playerid][pLicenseA]);fwrite(hFile, var);
        format(var, 32, "%d pLicenseB\n", PlayerInfo[playerid][pLicenseB]);fwrite(hFile, var);
        format(var, 32, "%d pLicenseC\n", PlayerInfo[playerid][pLicenseC]);fwrite(hFile, var);
        format(var, 32, "%d pLicenseH\n", PlayerInfo[playerid][pLicenseH]);fwrite(hFile, var);
        format(var, 32, "%d pSkin\n", PlayerInfo[playerid][pSkin]);fwrite(hFile, var);
        format(var, 32, "%d pTeam\n", PlayerInfo[playerid][pTeam]);fwrite(hFile, var);
        format(var, 32, "%d pWeapon1\n", PlayerInfo[playerid][pWeapon1]);fwrite(hFile, var);
        format(var, 32, "%d pAmmo1\n", PlayerInfo[playerid][pAmmo1]);fwrite(hFile, var);
        format(var, 32, "%d pWeapon2\n", PlayerInfo[playerid][pWeapon2]);fwrite(hFile, var);
        format(var, 32, "%d pAmmo2\n", PlayerInfo[playerid][pAmmo2]);fwrite(hFile, var);
        format(var, 32, "%d pWeapon3\n", PlayerInfo[playerid][pWeapon3]);fwrite(hFile, var);
        format(var, 32, "%d pAmmo3\n", PlayerInfo[playerid][pAmmo3]);fwrite(hFile, var);
        format(var, 32, "%d pRank\n", PlayerInfo[playerid][pRank]);fwrite(hFile, var);
        format(var, 32, "%d pArmour\n", PlayerInfo[playerid][pArmour]);fwrite(hFile, var);
        format(var, 32, "%d pBusinessKey\n", PlayerInfo[playerid][pBusinessKey]);fwrite(hFile, var);
        fclose(hFile);
        format(string, sizeof(string), "SERVER: Your account has been created, The next time you join, use /login %s", PlayerInfo[playerid][pPassword]);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        OnPlayerLogin(playerid,PlayerInfo[playerid][pPassword]);
        return 1;
    }
i choose a skin and i spawn then, i do then /login password, to test it when im spawned because the register say unknown command , so when i do login password when im spawned it say

Код:
SERVER: That nickname is already logged in.
so i try to reconnect, it say that i have a account so i do /login password it say to : unknown command same story..

pawn Код:
//login
if (strcmp(cmd, "/login", true) ==0)
    {
        new tmppass[64];
        if (gPlayerLogged[playerid] == 1)
        {
            SendClientMessage(playerid, COLOR_RED, "SERVER: That nickname is already logged in.");
            return 1;
        }
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GREY, "USAGE: /login [password]");
            return 1;
        }
        strmid(tmppass, tmp, 0, strlen(cmdtext), 32);
        OnPlayerLogin(playerid,tmp);
        return 1;
    }
Maybe you need onplayerlogin so here's the code

pawn Код:
//OnPlayerLogin
public OnPlayerLogin(playerid,const string[])
{
    new string2[64];
    new playername2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    format(string2, sizeof(string2), "/userfiles/%s.user", playername2);
    new File: file = fopen(string2, io_read);
    if (file)
    {
        new valtmp[128];
        fread(file, valtmp);strmid(PlayerInfo[playerid][pPassword], valtmp, false, strlen(valtmp)-1, 32);
        if ((strcmp(PlayerInfo[playerid][pPassword], string, true, strlen(valtmp)-1) == 0) || (strcmp("ҐҐҐ", string, true, strlen(valtmp)-1) == 0))
        {
          fread(file, valtmp);PlayerInfo[playerid][pLevel] = strval(valtmp);
          fread(file, valtmp);PlayerInfo[playerid][pExp] = strval(valtmp);
          fread(file, valtmp);PlayerInfo[playerid][pHouseOwner] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pAdmin] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pVip] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pBank] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pPocket] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pHouseKey] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pPerMute] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pJailedSec] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pKills] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pDeaths] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pLicenseA] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pLicenseB] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pLicenseC] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pLicenseH] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pSkin] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pTeam] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pWeapon1] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pAmmo1] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pWeapon2] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pAmmo2] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pWeapon3] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pAmmo3] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pRank] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pArmour] = strval(valtmp);
            fread(file, valtmp);PlayerInfo[playerid][pBusinessKey] = strval(valtmp);
            fclose(file);
            ResetPlayerMoney(playerid);
            GivePlayerMoney(playerid,PlayerInfo[playerid][pPocket]);
            gPlayerLogged[playerid] = 1;
            new housekey = PlayerInfo[playerid][pHouseKey];
            HouseInfo[housekey][hNotUsed] = 0; // This will 'reset' how many pd's the house is not used.
            new businesskey = PlayerInfo[playerid][pBusinessKey];
            BusinessInfo[businesskey][bNotUsed] = 0; // This will 'reset' how many pd's the business is not used.
            SendClientMessage(playerid, COLOR_YELLOW, "SERVER: You have been successfully logged in, Type /stats for more info.");
            CreateBankMoneyTextDraw(playerid);

            if(PlayerInfo[playerid][pPerMute] == 1)
            {
              SendClientMessage(playerid, COLOR_RED, "SERVER: You have been permanent muted, You cannot speak.");
            }
            if(PlayerInfo[playerid][pJailedSec] > 1)
            {
                format(string2, sizeof(string2), "SERVER: You have been jailed, Seconds in jail left: %d", PlayerInfo[playerid][pJailedSec]);
              SendClientMessage(playerid, COLOR_RED, string2);
              OnPlayerJailed(playerid);
            }
            if(PlayerInfo[playerid][pVip] == 1)
            {
                format(string2, sizeof(string2), "** Vip %s has been logged in **", playername2);
            SendClientMessageToAll(COLOR_RED, string2);
        }
            if(PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] != 7)
            {
                format(string2, sizeof(string2), "** Admin %s has been logged in (admin lvl: %d) **", playername2, PlayerInfo[playerid][pAdmin]);
            SendClientMessageToAll(COLOR_RED, string2);
        }
        if(PlayerInfo[playerid][pAdmin] == 0)
        {
            format(string2, sizeof(string2), "Player %s has been logged in (player lvl: %d)", playername2, PlayerInfo[playerid][pLevel]);
                SendClientMessageToAll(COLOR_YELLOW, string2);
            }
        if(GetPlayerSkin(playerid) == 0)
        {
          if(PlayerInfo[playerid][pSkin] != 0 && PlayerInfo[playerid][pTeam] != 0)
                {
                  SpawnPlayer(playerid);
                  return 1;
            }
        }
            return 1;
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "SERVER: That password is incorrect, Try again.");
            fclose(file);
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "SERVER: That nickname is not registered, Try /register");
    }
    return 1;
}
Reply


Messages In This Thread
Register system bugg? - by sjvt - 10.03.2010, 20:00
Re: Register system bugg? - by sjvt - 10.03.2010, 20:25
Re: Register system bugg? - by Carlton - 10.03.2010, 20:27
Re: Register system bugg? - by sjvt - 10.03.2010, 20:51
Re: Register system bugg? - by sjvt - 10.03.2010, 20:51
Re: Register system bugg? - by Carlton - 10.03.2010, 20:55
Re: Register system bugg? - by sjvt - 10.03.2010, 20:56
Re: Register system bugg? - by sjvt - 10.03.2010, 20:58
Re: Register system bugg? - by sjvt - 10.03.2010, 21:06
Re: Register system bugg? - by Carlton - 10.03.2010, 21:07

Forum Jump:


Users browsing this thread: 1 Guest(s)