SA-MP Forums Archive
jb kicker? - 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: jb kicker? (/showthread.php?tid=250379)



jb kicker? - sciman001 - 23.04.2011

ok.. just read this then read the errors then fix it and reply!!!
pawn Код:
if(strcmp(pname, "justin bieber", false, 128));
{
     Kick(playerid);
     return 1;
}
pawn Код:
C:\Documents and Settings\Matt\Desktop\party time\gamemodes\PARTY.pwn(127) : error 036: empty statement
C:\Documents and Settings\Matt\Desktop\party time\gamemodes\PARTY.pwn(133) : warning 225: unreachable code
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
HMMM... What to do


Re: jb kicker? - Backwardsman97 - 23.04.2011

pawn Код:
if(!strcmp(pname, "justin bieber", true));
{
     Kick(playerid);
     return 1;
}
Remove the 128? And strcmp returns 0 when they match.


Re: jb kicker? - sciman001 - 23.04.2011

pawn Код:
if(!strcmp(pname, "justin bieber", true));
    {
        Kick(playerid);
        return 0;
    }
same errors....


Re: jb kicker? - coole210 - 23.04.2011

maybe your doing it wrong.. try this?

Код:
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname);
if(!strcmp(pname, "justin bieber", true))
    {
        Kick(playerid);
        return 0;
    }



Re: jb kicker? - sciman001 - 23.04.2011

omfg were dumb... we had to remove the ; on:
if(!strcmp(pname, "justin bieber", true));
wooooooooooooooooooooooooooow!!!!!!!!!!!!!!!!


Respuesta: jb kicker? - Alex_Obando - 23.04.2011

So how is it?
Can you post the whole script so I can see it pls.


Re: jb kicker? - sciman001 - 23.04.2011

pawn Код:
public OnPlayerConnect(playerid)
{
    new pname[MAX_PLAYER_NAME], str[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));

    if(!strcmp(pname, "justin bieber", true))
    {
        Kick(playerid);
        return 0;
    }

    if(strlen(pname) > 12) // Will kick the player if his name is longer than 12 characters.
    {
        SendClientMessage(playerid, COLOR_RED, "Your name is too long, It must be 12 or less characters.");
        Kick(playerid);
        return 0;
    }

    SendClientMessage(playerid, COLOR_GREEN, "PLEASE USE /help FOR SOME SERVER INFO AND COMMANDS");
    UsePlayerPedAnims();
    UpdateTimeForAll();
    format(str, sizeof(str), USERFILE, pname);
    new ip[24];
    GetPlayerIp(playerid, ip, sizeof(ip));
    if(!fexist(str))
    {
        djAutocommit(false);
        djCreateFile (str);
        djSet(str,"player/NAME", pname);
        djSetInt(str,"player/SCORE",GetPlayerScore(playerid));
        djSetInt(str,"player/CASH",GetPlayerMoney(playerid));
        djSet(str,"player/IP", ip);
        djCommit(str);
        djAutocommit(true);
    }
    else
    {
        if(!strcmp(ip, dj(str, "player/IP")))
        {
            SetPlayerScore(playerid, djInt(str, "player/SCORE"));
            ResetPlayerMoney(playerid);
            GivePlayerMoney(playerid, djInt(str, "player/CASH"));
        }
        else
        {
            new string[128];
            format(string, sizeof(string), "YOU ARENT THE REAL %s!! GTFO!", pname);
            SendClientMessage(playerid, COLOR_RED, string);
            Kick(playerid);
            return 0;
        }
    }
    return 1;
}
dont work.. but i dont care. No errors... maybe its since i have this : #undef MAX_PLAYER_NAME and #define MAX_PLAYER_NAME 12 because of djson .... if the name is too large... it wont save the .json thing... anyway.. ya.


Re: jb kicker? - Backwardsman97 - 23.04.2011

Well it's only going to kick him if his name is exactly 'justin bieber'. You could search the name for the words 'justin' and 'bieber'.