SA-MP Forums Archive
How to make these two work together? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to make these two work together? (/showthread.php?tid=456900)



How to make these two work together? - PrezyI - 08.08.2013

pawn Код:
//OnPlayerConnect
    new name[24], ip[16];
    GetPlayerIp(playerid, ip, sizeof ip);
    GetPlayerName(playerid, name, sizeof name);
    for(new id; < 24; id++)
    {
        if(!strmcp(name,TempBans[id][BannedName]))
        {
            SendClientMessage(playerid, Red,"Your ban has not expired");
            Kick(playerid);
            return 1;
        }

        if(!strmcp(ip,TempBans[id][BannedIP]))
        {
            SendClientMessage(playerid, Red, "Your ban has not expired");
            Kick(playerid);
            return 1;
        }
    }
    return 1;


pawn Код:
//OnPlayerConnect
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    if(fexist(Path(playerid)))
    {
        INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid,login,DIALOG_STYLE_INPUT,"Login","Welcome Back!\n Please login with your password","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid,register,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
        return 1;
    }
    return 1;
}
Can't really figure it out since I am getting shit loads of errors.


Re: How to make these two work together? - Vanter - 08.08.2013

pawn Код:
new name[24], ip[16];
    GetPlayerIp(playerid, ip, sizeof ip);
    GetPlayerName(playerid, name, sizeof name);
    for(new id; < 24; id++)
    {
        if(!strmcp(name,TempBans[id][BannedName]))
        {
            SendClientMessage(playerid, Red,"Your ban has not expired");
            Kick(playerid);
            return 1;
        }

        if(!strmcp(ip,TempBans[id][BannedIP]))
        {
            SendClientMessage(playerid, Red, "Your ban has not expired");
            Kick(playerid);
            return 1;
        }
   }
    if(fexist(Path(playerid)))
    {
        INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid,login,DIALOG_STYLE_INPUT,"Login","Welcome Back!\n Please login with your password","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid,register,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
        return 1;
    }
return 1;
}



Re: How to make these two work together? - PrezyI - 08.08.2013

Код:
(250) :error 029: invalid expression, assumed zero
(250) : warning 215: expression has no effect
(250) : error 001: expected token: ")", but found ";"
(250) : error 036: empty statement
(250) : fatal error 107: too many error messages on one line
pawn Код:
//code 250
 for(new id; < 24; id++)



Re: How to make these two work together? - Vanter - 08.08.2013

That's your reading through files, I don't think I can help you with that, ,maybe someone else can


Re: How to make these two work together? - Elysian` - 08.08.2013

You was right, however it should be
pawn Код:
for(new id = 0; id < 24; id++)
not
pawn Код:
for(new id; < 24; id++)
I recommend using foreach as it's a ton easier.