Vice City Multiplayer

VC:MP => mIRC/pawn Scripting => ShowRoom (pawn) => Topic started by: Madara on March 11, 2011, 06:14:02 AM

Title: System Banneds by Madara
Post by: Madara on March 11, 2011, 06:14:02 AM
First download this link:http://www.mediafire.com/?jnr27599hribuio (http://www.mediafire.com/?jnr27599hribuio), brings in a folder that says "Banneds" you put that folder in the folder "scriptfiles" (if you do not, create it). and paste these 4 functions in your "GameMode":

public InfoPlayerBanned(playerid)
{
new IP[256],MSN[256],BAN;
GetPlayerIp(playerid,IP,256);
BAN = dini_Int("/Banneds/Banlist.ini",IP);//find IP in the list.
if(BAN == 1){// if the IP in the list is 1, kick player (1 = true, 0 = false)
           format(MSN,256,">> Server Auto-Kick: %s - Reason: [IP Banned]",PlayerName(playerid));
           SendClientMessageToAll(0x377DFFFF,MSN);
           Kick(playerid);//kick player :P
                   }
}

public PlayerBanIP(playerid,admin,reason[])
{
       new IP[256],MSN[256],inf[256];
       GetPlayerIp(playerid,IP,256);
       format(inf,256,"1 %s %s %s",PlayerName(playerid),PlayerName(admin),reason);//info to archive player banned
       dini_Set("/Banneds/Banlist.ini",IP,inf);//send to ban list
       dini_Set("/Banneds/PlayerBanlist.ini",gPlayers[playerid],IP);//send to player and IP
       format(MSN,256,">> Admin %s Banned: %s, ID: %d, Reason:%s",gPlayers[admin],gPlayers[playerid],playerid,reason);
       SendClientMessageToAll(0x377DFFFF,MSN);
       Kick(playerid);//kick player xP
}

public PlayerUnBanIP(player[],admin,reason[])
{
new MSN[256],IP[256],param[2][128];
IP = dini_Get("/Banneds/PlayerBanlist.ini",player);
       split(dini_Get("/Banneds/Banlist.ini",IP), param, ' ');
       format(MSN,256,">> Admin %s Un-Banned: %s, Reason:%s",PlayerName(admin),param[1],reason);
       SendClientMessageToAll(0x377DFFFF,MSN);
       dini_Unset("/Banneds/Banlist.ini",IP);//remove IP banned the list
       dini_Unset("/Banneds/PlayerBanlist.ini",player);//remove the name list
}

public IsPlayerBanned(player[])
{
new ispb[256];
ispb = dini_Get("/Banneds/PlayerBanlist.ini",player);//find IP to check list banneds
return (strcmp(ispb, "0", true) == 0) ? false : true;//checks the existence of the player or not
}


Now, in function "public OnPlayerConnect (playerid)," hit this InfoPlayerBanned (playerid), which would be more or less if:

public OnPlayerConnect(playerid)
{
InfoPlayerBanned(playerid);
return 1;
}


Now paste these 2 commands in function "public OnPlayerCommandText (playerid, cmdtext [])":

   else if (strcmp(cmd, "ban", true) == 0) {
new plr,reason[256];
tmp = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp), reason = strtok(cmdtext, idx);
if (!strlen(reason)) SendClientMessage(playerid,0x04A36BFF,"** pm >> [Syntax] - The correct use: /c ban <player> <reason>");
  else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,0x04A36BFF,"** pm >> [Error] - Unknown player.");
else {
                PlayerBanIP(plr,playerid,cmdtext[strval(reason)+strlen(tmp)+4]);
}
return 1;
    }

   else if (strcmp(cmd, "unban", true) == 0) {
new reason[256];
tmp = strtok(cmdtext, idx), reason = strtok(cmdtext, idx);
if (!strlen(reason)) SendClientMessage(playerid,0x04A36BFF,"** pm >> [Syntax] - The correct use: /c unban <player> <reason>");
  else if (!IsPlayerBanned(tmp)) SendClientMessage(playerid,0x04A36BFF,"** pm >> [Error] - This player is't banned, insert full name.");
else {
               PlayerUnBanIP(tmp,playerid,cmdtext[strval(reason)+strlen(tmp)+6]);
}
return 1;
    }


And define this function, if not exist:

stock PlayerName(playerid)
{
      new name[24];
      GetPlayerName(playerid,name,24);
      return name;
}


All these are functions that are used to see a player banned and check if it exists in the list.

Credits: YO ( Madara ).

Greetings ;)
Title: Re: System Banneds to Pawno
Post by: yazeen on March 11, 2011, 06:30:27 AM
COOOL great work dude  8) 8)
Title: Re: System Banneds to Pawno
Post by: BIG[H] on March 11, 2011, 02:39:41 PM
Man You know Terminatorupgrade2 it was me!! you gave me first ! i won!! :D
Title: Re: System Banneds to Pawno
Post by: John321 on March 12, 2011, 02:35:34 AM
nice work madara remember me dude?
Title: Re: System Banneds to Pawno
Post by: Madara on March 12, 2011, 02:49:14 AM
How?, you are Terminatorupgrade2 ???... and now are BIG[H] ??? ??
Title: Re: System Banneds to Pawno
Post by: shivambansal on March 12, 2011, 04:51:19 AM
hii madara
[VR]Avinash ;D
Title: Re: System Banneds to Pawno
Post by: BIG[H] on March 12, 2011, 05:35:49 AM
:D YES !!
Title: Re: System Banneds to Pawno
Post by: Castagna96 on March 12, 2011, 07:11:31 AM
great job carbon i use it for my server thanks wey  :P :P