SA-MP Forums Archive
Less line - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Less line (/showthread.php?tid=201930)



Less line - LZLo - 22.12.2010

Quote:

new kName[MAX_PLAYER_NAME];
GetPlayerName(playerid, kName, sizeof(kName));
if(!strcmp("mettuss",kName,true))
{
new rsstring[256];
ShowPlayerDialog(playerid,HELLZSECURITY,DIALOG_STY LE_INPUT,"Anti-HACKER Boss Security System!",rsstring,"OK","IP BAN");
}
else
if(!strcmp("hotdog22",kName,true))
{
new rsstring[256];
ShowPlayerDialog(playerid,HELLZSECURITY,DIALOG_STY LE_INPUT,"Anti-HACKER Boss Security System!",rsstring,"OK","IP BAN");
}
else
if(!strcmp("forceman007",kName,true))
{
new rsstring[256];
ShowPlayerDialog(playerid,HELLZSECURITY,DIALOG_STY LE_INPUT,"Anti-HACKER Boss Security System!",rsstring,"OK","IP BAN");
}

how can i do this with less line?


Re: Less line - Nero_3D - 22.12.2010

pawn Код:
static const BadName[][] = {
    "mettuss",
    "hotdog22",
    "forceman007"
};

new kName[MAX_PLAYER_NAME];
GetPlayerName(playerid, kName, sizeof(kName));
for(new i; i != sizeof BadNames; i++) {
    if(strcmp(kName, BadName[i], true) == 0) {
        ShowPlayerDialog(playerid, HELLZSECURITY, DIALOG_STYLE_INPUT,
            "Anti-HACKER Boss Security System!", kName, "OK", "IP BAN");
    }
}



Re: Less line - smeti - 22.12.2010

Try:
Not tested!
pawn Код:
new
    CheaterName[][MAX_PLAYER_NAME] =
{
    "mettuss",
    "hotdog22",
    "forceman007"
};

new
    kName[MAX_PLAYER_NAME];
GetPlayerName(playerid, kName, sizeof(kName));

for(new i; i < sizeof(ChaeterName); i++)
{
    if(!strcmp(CheaterName[i], kName, true))
    {
        new
            rsstring[64];
        ShowPlayerDialog(playerid, HELLZSECURITY, DIALOG_STYLE_INPUT, "Anti-HACKER Boss Security System!", rsstring, "OK","IP BAN");
        return 1;
    }
}
Oh sorry two minutes


Re: Less line - LZLo - 22.12.2010

thanks