/ban and /kick
#1

Well guys, I need the whole /ban and /kick pwano code I searched it in wiki.sa-mp.com but that code is /banme and it's fucking anoying I changed it a lot of times and still doesn't work. If anyone can help me with this. I'm asking this because I'm a scripter beginer.


Really thank

P.S: I can't show you guys because I'm on my cellphone.
Reply
#2

Quote:

CMD:kick(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 2)
{
new string[128], giveplayerid, reason[64];
if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /kick [playerid] [reason]");

if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin] && (PlayerInfo[giveplayerid][pHelper] >= 2 || PlayerInfo[giveplayerid][pAdmin] > 0) && playerid != giveplayerid)
{
format(string, sizeof(string), "AdmCmd: %s has been auto-kicked, reason: Trying to /kick a higher admin.", GetPlayerNameEx(playerid));
ABroadCast(COLOR_YELLOW,string, (PlayerInfo[playerid][pAdmin] == 1) ? (1) : (2));
Kick(playerid);
return 1;
}
else
{
new year, month,day;
getdate(year, month, day);
new playerip[32];
GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
format(string, sizeof(string), "AdmCmd: %s (IP:%s) was kicked by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
Log("logs/kick.log", string);
if(PlayerInfo[playerid][pAdmin] == 1) Log("logs/moderator.log", string);
format(string, sizeof(string), "AdmCmd: %s was kicked by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
SendClientMessageToAllEx(COLOR_LIGHTRED, string);
Kick(giveplayerid);
}
return 1;
}
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
return 1;
}

That's the kick, I will do the ban now for you.

Quote:

CMD:ban(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 2)
{
new string[128], giveplayerid, reason[64];
if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /ban [playerid] [reason]");

if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
{
format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin.", GetPlayerNameEx(playerid));
ABroadCast(COLOR_YELLOW,string,2);
PlayerInfo[playerid][pBanned] = 1;
new ip[32];
GetPlayerIp(playerid,ip,sizeof(ip));
AddBan(ip);
Kick(playerid);
return 1;
}
else
{
new year, month,day;
getdate(year, month, day);
new playerip[32];
GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
Log("logs/ban.log", string);
format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
SendClientMessageToAllEx(COLOR_LIGHTRED, string);
PlayerInfo[giveplayerid][pBanned] = 1;
format(PlayerInfo[giveplayerid][pFlag], 128, "");
new ip[32];
GetPlayerIp(giveplayerid,ip,sizeof(ip));
AddBan(ip);
Kick(giveplayerid);
return 1;
}

}
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
return 1;
}

That's the ban, there are very easy to do, there one's from the script I am currently making. Enjoy
Reply
#3

HAHAHAHAHAHAHAHAHAHAHAHAHAHA. No. Use your own work, instead of copying it from the NGRP script.

You can easily create these commands, heres an example:

pawn Код:
CMD:kick(playerid, params[])
{
    new pID, szReason[16], szString[128], myName[32], pName[32];
    if(PlayerInfo[playerid][pAdmin] > 0) // Change this to your admin variable
    {

        if(sscanf(params, "us[16]", pID, szReason)) return SendClientMessage(playerid, -1, "SYNTAX: /kick [playerid] [reason]");
       
        if(IsPlayerConnected(pID)) // Checking if the ID/name the person entered is online
        {
            GetPlayerName(pID, pName, sizeof(pName));
            GetPlayerName(playerid, myName, sizeof(myName));
       
            format(szString, sizeof(szString), "%s has kicked %s, reason: %s.", myName, pName);
            SendClientMessageToAll(-1, szString); // broadcasting it to everyone
            Kick(pID); // kicking the player
        }
        else SendClientMessage(playerid, -1, "Invalid player ID!");
    }
    else SendClientMessage(playerid, -1, "You are not allowed to use this command!");
    return 1;
}
You can simply change the 'kick(playerid);' to 'Ban(playerid);' then rename the command, etc.
Reply
#4

warning 203: symbol "kick" is never used
warning 203: symbol "ban" is never used.

?

EDIT: What I need to change if I want /ban comand only for lvl 2 admin?
Reply
#5

Quote:
Originally Posted by PabloDiCostanzo
Посмотреть сообщение
warning 203: symbol "kick" is never used
warning 203: symbol "ban" is never used.

?

EDIT: What I need to change if I want /ban comand only for lvl 2 admin?
Did you use his command or mine?

For level 2 admin, just put
if(PlayerInfo[playerid][pAdmin] >= 2) instead of the if(PlayerInfo[playerid][pAdmin] > 0)
Reply
#6

I used his command (Xenon).


Thanks for lvl 2 answer.
Reply
#7

Warning 203 comes up when you already have defined a variable or variable in a function and you are not using it anywhere, so find them and either delete them or comment them out.
Reply
#8

Quote:
Originally Posted by emokidx111
Посмотреть сообщение
Warning 203 comes up when you already have defined a variable or variable in a function and you are not using it anywhere, so find them and either delete them or comment them out.
EDIT: I did this, but still doesenґt work. Same warning: symbol is never used.
Reply
#9

Quote:
Originally Posted by PabloDiCostanzo
Посмотреть сообщение
Okay, I'll try.

I have an other question. Why when I use this "CMD:example.....] I evert get an error/warning. I don't don't know what to include with this. I try with #include <a_samp> but I get the error/warning too.
zcmd
Reply
#10

Quote:
Originally Posted by [ABK]Antonio
Посмотреть сообщение
zcmd
CMD work now you was posting when I edit the message :P.

I still have this "warning: symbol never used" and I dont use any symbol because this is my 1є script. I mean I dont have other script
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)