[Tutorial] How to create clan tag checker
#1

Hello all today i made clan tag checker code if any one comes with any clan tag and he is not in the clan members then he will be automatic kicked and if he is in the clan members then he can access in the clan

here is the code

1-Step
type this code on top of your gamemode
pawn Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
2- Step

type this code under OnPlayerSpawn()

pawn Код:
public OnPlayerSpawn(playerid)
{
       new name[24]; // Makes a new string for the name
       GetPlayerName(playerid,name,sizeof(name)); // Assigns it to the name
       if(strfind(name,"[Put the clan tag here]",true) != -1) // The != is if it was found.
       {
          if(PlayerInfo[playerid][pClan] >= 1) // In this case the clan they need to be in is 1
      {
        // If they are not in the clan then it kicks them.
            SCM(playerid, COLOR_LIGHTRED, "** Welcome to clan [Put the clan tag here] **");
                return 1;
      }
      else
      {
        // If they are then send them a nice welcome message. :)
           SCM(playerid, COLOR_LIGHTRED, "** You are not in [Put the clan tag here] clan. Result is kick from the server **");
               KickPlayer[playerid] = 1;
      }
      }
2-Step
now make the command for make clan member

pawn Код:
dcmd_setclanmember(playerid, params[])
{
if ( IsPlayerConnected ( playerid ) )
{
if(PlayerInfo[playerid][pAdmin] >= 3)
{
new nom [ MAX_PLAYER_NAME ] , str [ 200 ] , pid;
if ( sscanf ( params, "u" , pid ) ) return SendClientMessage ( playerid , 0xBEBEBEAA , "[ERROR]: /setclanmember [playerid]" ) ;
{
GetPlayerName ( playerid , nom , sizeof ( nom ) ) ;
GetPlayerName ( pid , nom , sizeof ( nom ) ) ;
format ( str , sizeof ( str ) , "*You Have Successfuly Set %s As An Clan Member!" , nom ) ;
SendClientMessage ( playerid , 0x00FF00AA , str ) ;
format ( str , sizeof ( str ) , "*%s Has Made You A [Put the clan tag here] Clan Member! Now You Are Allowed To Use [Put the clan tag here] Tag in Your Name!" , nom ) ;
SendClientMessage ( playerid , 0x00FF00AA , str ) ;
PlayerInfo[playerid][pClan] = 1 ;
strins(nom,"[Put the clan tag here]",0,sizeof(nom));
SetPlayerName(pid,nom);
}
}
else
SendClientMessage ( playerid, 0x8B1A1AAA , "[ERROR] You need Admin Level 3 to use this Command!" ) ;
}
else
SendClientMessage ( playerid , 0x8B1A1AAA , "[ERROR] Player Not Connected!" ) ;
return 1;
}
3-Step

Now make the command for Kick a member from clan

pawn Код:
dcmd_kickclanmember(playerid, params[])
{
if ( IsPlayerConnected ( playerid ) )
{
if(PlayerInfo[playerid][pAdmin] >= 3)
{
new nom [ MAX_PLAYER_NAME ] , str [ 200 ] , pid;
if ( sscanf ( params, "u" , pid ) ) return SendClientMessage ( playerid , 0xBEBEBEAA , "[ERROR]: /kickclanmember [playerid]" ) ;
{
GetPlayerName ( playerid , nom , sizeof ( nom ) ) ;
GetPlayerName ( pid , nom , sizeof ( nom ) ) ;
format ( str , sizeof ( str ) , "*You Have Kicked %s From clan member list" , nom ) ;
SendClientMessage ( playerid , 0x00FF00AA , str ) ;
format ( str , sizeof ( str ) , "*Admin %s Has Kick You From [Put the clan tag here] Clan! Now Remove your [Put the clan tag here] Tag!" , nom ) ;
SendClientMessage ( playerid , 0x00FF00AA , str ) ;
PlayerInfo[playerid][pClan] = 0 ;
}
}
else
SendClientMessage ( playerid, 0x8B1A1AAA , "[ERROR] You need Admin Level 3 to use this Command!" ) ;
}
else
SendClientMessage ( playerid , 0x8B1A1AAA , "[ERROR] Player Not Connected!" ) ;
return 1;
}
Bugs
-No bugs found If you found any bugs then pm me
Thats all
Good luck

Regards IceBilizard
Reply
#2

Hmm would be great for a TDM / Dm server maybe you can add something like textdraws for a clan image hmmm just saying
Reply
#3

You didn't add a way to load, save, or even add the variable to the enum.

DCMD is highly outdated.

There's no define for SCM.

Why does str have a size of 200?

KickPlayer is never defined.





I highly doubt you tested this code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)