strcmp & arrays
#1

Okay, so I got a couple things to ask about.

First, I'm making a "tag ban" script. When I use strcmp, set the length to 4, no matter who joins it will kick them if they have [ & ] & A & A in they're name. Here's the code:
Код:
    if(strcmp(pName, "[HB]", false, 4))
    {
        if(!GetPVarInt(playerid, "Admin"))
        {
			SendClientMessage(playerid, COLOR_RED, "The tag [HB] is admin only!");
			Kick(playerid);
        }
    }
Second, I want to create an array of commands. That array will be the commands that doesn't show up in admin see all, I'm not good with arrays and am not sure if you can just compare the string right off. Can someone explain how this can be achieved?

Thanks,
Scott
Reply
#2

Try
pawn Код:
if(strcmp(pName, "[HB]") == 0)
    {
        if(!GetPVarInt(playerid, "Admin"))
        {
            SendClientMessage(playerid, COLOR_RED, "The tag [HB] is admin only!");
            Kick(playerid);
        }
    }
Reply
#3

pawn Код:
if(strfind(pName, "[HB]", true) != -1)
    {
        if(!GetPVarInt(playerid, "Admin"))
        {
            SendClientMessage(playerid, COLOR_RED, "The tag [HB] is admin only!");
            Kick(playerid);
        }
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)