Clan Tag Checker
#1

Hey, im trying to create tag for my server and #ONLY_ADMINS can join with it but it let anyone joins, here is the code
that code under onplayerconnect and after logging in

pawn Код:
if(strfind(name,"[EXP]",true) != -1)
    {
        if(PlayerInfo[playerid][Level] >= 2)
        {
            format(string9, sizeof(string9), "%s {%d} has been kicked for having [EXP] clan-tag in their name.", name, playerid);
            SendClientMessageToAll(COLOR_ORANGE, string9);
            return 1;
        }
   }
Reply
#2

Well, you forgot the actual kick command!
Reply
#3

im using it on gm but forgot to post it here my mistake,
Reply
#4

If you don't need much just make a list of protected tags then check them against the players name using strfind https://sampwiki.blast.hk/wiki/Strfind .

If you need a whole new system based on tags it would be more work.
Reply
#5

bump
Reply
#6

Something like this:
pawn Код:
if(strfind(name, "[EXP]", true) != -1)
{
    if(PlayerInfo[playerid][Level] == 0)
    {
        format(string9, sizeof(string9), "%s {%d} has been kicked for having [EXP] clan-tag in their name.", name, playerid);
        SendClientMessageToAll(COLOR_ORANGE, string9);
        KickPlayer(playerid);
    }
}

stock KickPlayer(playerid) return SetTimerEx("KickPlayerEx", 100, false, "i", playerid);

function KickPlayerEx(playerid) return Kick(playerid);
Reply
#7

You're checking i the player's admin level is higher or equal to 2, so admins cannot join with that tag.
You should use
pawn Код:
if(PlayerInfo[playerid][Level] < 2)
Reply
#8

Admins and everyone else can join with tag i don't know whats wrong
Reply
#9

Your script should look somewhat like this:
Код:
KickEx(playerid) SetTimerEx("KickTimer", 100, false, "i", playerid);

public OnPlayerConnect(playerid)
{
    new
        name[21],
        string9[44 + 21]
    ;
    GetPlayerName(playerid, name, sizeof(name));
    if(strfind(name, "[EXP]", true) != -1)
    {
        if(PlayerInfo[playerid][Level] < 2)
        {
            format(string9, sizeof(string9), "%s {%d} has been kicked for having [EXP] clan-tag in their name.", name, playerid);
            SendClientMessageToAll(COLOR_ORANGE, string9);
            KickEx(playerid);
        }
    }
    return 1;
}

forward KickTimer(playerid);
public KickTimer(playerid) Kick(playerid);
That should work.
Reply
#10

Код:
public OnPlayerConnect(playerid)
{
   new name[24]; GetPlayerName(playerid, name, 24);
   if(strfind(name, "[EXP]", true) != -1)  // check clan in player's name
    {
	   if(PlayerInfo[playerid][AdminLevel] == 0) // check is player admin ? if not then kick
	   {
		   new kickmsg[256];
                   format(kickmsg, sizeof(kickmsg), "%s [%d] has been kicked for having [EXP] clan-tag in their name.", name, playerid);
         	   SendClientMessageToAll(COLOR_ORANGE, kickmsg);
	           SetTimerEx("ServerKick",500,0,"i",playerid);
	   }
    }
}

forward ServerKick(playerid);
public ServerKick(playerid) 
{
   Kick(playerid);
}
This code will work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)