Some errors on /login
#1

Код:
command(login,playerid,params[])
{
    new file[256],n[MAX_PLAYER_NAME];
    new pass;
    GetPlayerName(playerid,n,MAX_PLAYER_NAME);
    format(file,sizeof(file),"WolfAdmin/Users/%s.txt",n);
    if(!fexist(file)) return SendClientMessage(playerid,RED,"You are not registered! Please /register");
    if(PInfo[playerid][Logged] == 1) return SendClientMessage(playerid,RED,"You are already logged in!");
    if(PInfo[playerid][Regged] == 0) return SendClientMessage(playerid,RED,"You are not registered, please /register");
    if (!sscanf(params, "ii", pass))
    {
        new pass[256];
        pass = INI_ParseFile(file, "LoadStats", false, true, playerid, true, false);
        GetPVarString(playerid, "pPass", pass, sizeof(pass));
        if(!strcmp(params, pass, false))
            {
                SetPlayerScore(playerid, PInfo[playerid][Score]);
				ResetPlayerMoney(playerid);
				GivePlayerMoney(playerid, PInfo[playerid][Cash]);
				PInfo[playerid][Level] = PInfo[playerid][Level1];
				PInfo[playerid][Kills] = PInfo[playerid][Kills1];
				PInfo[playerid][Deaths] = PInfo[playerid][Deaths1];

                               new INI:PlayerAcc = INI_Open(file);
                               INI_WriteInt(PlayerAcc,"Logged",1);
                               INI_Close(PlayerAcc);
                               PInfo[playerid][Logged] = 1;
				SendClientMessage(playerid,LIMEGREEN,"You are now logged in");
			}
		}
		else 
		{
		    SendClientMessage(playerid,RED,"ERROR: Wrong Password");
		}
	}
	else
	{
	    SendClientMessage(playerid,RED,"Usage: /login [password]");
	}
	return 1;
}
Errors:
Код:
C:\Users\Chris\Documents\Serv\Server\gamemodes\COS.pwn(1926) : warning 219: local variable "pass" shadows a variable at a preceding level
C:\Users\Chris\Documents\Serv\Server\gamemodes\COS.pwn(1927) : error 033: array must be indexed (variable "pass")
C:\Users\Chris\Documents\Serv\Server\gamemodes\COS.pwn(1949) : warning 209: function "cmd_login" should return a value
C:\Users\Chris\Documents\Serv\Server\gamemodes\COS.pwn(1950) : error 010: invalid function or declaration
C:\Users\Chris\Documents\Serv\Server\gamemodes\COS.pwn(1954) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Using sscanf2, zcmd, y_ini.

Bleh, I just started to use sscanf2 so if anyone can help me..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)