Jump to content
  • 0

Newbie


snK.

Question

Salut,sunt cam praf in scripting si am gasit un server care are /ban [id] [Reason] fara [Days]...

Si nu stiu cum sa fac sa aibe si zile...

Ajutor va rog :|

Uitati aici comanda :|

CMD:ban(playerid,params[])

{

if(AccInfo[playerid][LoggedIn] == 1)

{

if(AccInfo[playerid][Level] >= 7)

{

new tmp2[30], string[128], year, month, day, hour, minuite, second, userid, player1, fuuid;

//------------------------------------------------------------------

    if(sscanf(params, "us[30]", player1, tmp2)) return

SendClientMessage(playerid, LIGHTBLUE2, "Usage: /ban [PlayerID] [Reason]") &&

SendClientMessage(playerid, orange, "Function: Will Ban the specified player");

//------------------------------------------------------------------

if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (AccInfo[player1][Level] != ServerInfo[MaxAdminLevel]))

{

    //--------------------------------------------------------------

    if((gettime() - ABanAll[playerid]) < 40)

    {

        AccInfo[playerid][banLimit]++;

    }

    else

    {

        AccInfo[playerid][banLimit] = 0;

        ABanAll[playerid] = gettime();

    }

    //--------------------------------------------------------------

    if(AccInfo[playerid][banLimit] == 4)

    {

fuuid = BUD::GetNameUID(PlayerName2(playerid));

BUD::SetIntEntry(fuuid, "Banned", 1);

    SendClientMessage(playerid, red, "You have been automatically Banned by our Server (Reason: Ban All Try)!");

BanEx(playerid, "Banned by - Anti-Ban All System");

}

    //--------------------------------------------------------------

    else

    {

getdate(year, month, day); gettime(hour,minuite,second);

//----------------------------------------------------------

SendCommandToAdmins(playerid,"Ban");

                //----------------------------------------------------------

              ASts[playerid][bans] += 1;

                //----------------------------------------------------------

SendClientMessageToAll(red, "==============(Ban Details)==============");

if(AccInfo[playerid][Hide] == 1)

{

format(string, 128, "%s has been Banned", PlayerName2(player1));

}

else if(AccInfo[playerid][Hide] == 0)

{

    format(string, 128, "%s has been Banned by %s", PlayerName2(player1), PlayerName2(playerid));

}

SendClientMessageToAll(orange, string);

format(string, 128, "Reason: %s", tmp2);

SendClientMessageToAll(0xBF993FAA,string);

format(string, 128,"Date: %d/%d/%d | Time: %d:%d", day, month, year, hour, minuite);

SendClientMessageToAll(orange, string);

                SendClientMessageToAll(red, "======================================");

//----------------------------------------------------------

SendClientMessage(player1, -1, ""); SendClientMessage(player1, -1, "");

SendClientMessage(player1, -1, ""); SendClientMessage(player1, -1, "");

SendClientMessage(player1, -1, ""); SendClientMessage(player1, -1, "");

SendClientMessage(player1, -1, ""); SendClientMessage(player1, -1, "");

                SendClientMessage(player1, -1, ""); SendClientMessage(player1, -1, "");

                SendClientMessage(player1, -1, ""); SendClientMessage(player1, -1, "");

                SendClientMessage(player1, -1, ""); SendClientMessage(player1, -1, "");

                SendClientMessage(player1, -1, ""); SendClientMessage(player1, -1, "");

                SendClientMessage(player1, -1, ""); SendClientMessage(player1, -1, "");

                SendClientMessage(player1, -1, ""); SendClientMessage(player1, -1, "");

//----------------------------------------------------------

SendClientMessage(player1, red, "==============(Ban Details)==============");

    format(string, 128, "You have been {11FF00}Banned{AFAFAF} by {11FF00}%s", PlayerName2(playerid));

SendClientMessage(player1, grey, string);

format(string, 128, "Reason: {11FF00}%s", tmp2);

SendClientMessage(player1, grey, string);

format(string, 128, "Press {11FF00}F8{AFAFAF} to make an Screenshot! Visit {11FF00}www.aiciforum.com{AFAFAF} for UnBan!", day, month, year, hour, minuite);

SendClientMessage(player1, grey, string);

                SendClientMessage(player1, red, "======================================");

//----------------------------------------------------------

format(string, 128,"%s has been Banned by Administrator %s | Reason: %s", PlayerName2(player1), PlayerName2(playerid),tmp2);

SaveIn("BanLog", string);

//----------------------------------------------------------

userid = BUD::GetNameUID(PlayerName2(player1));

BUD::SetIntEntry(userid, "Banned", 1);

return Ban(player1);

}

return 1;

}

            else return SendClientMessage(playerid, red, "ERROR: Player is not connected or is yourself or is the highest level admin");

}

else return SendClientMessage(playerid, red, "ERROR: You must be Level 7 to use this command!");

}

else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");

}

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

[pawn]// Bans a player for (days, hours, minutes, seconds)

COMMAND:ban(playerid, params[])

{

// Setup local variables

new PlayerToBan, Days, Hours, Reason[128], TotalBanTime, Msg[128], Name[24], AdminName[24];

// Send the command to all admins so they can see it

SendAdminText(playerid, "/ban", params);

// Check if the player has logged in

if (APlayerData[playerid][LoggedIn] == true)

{

// Check if the player's admin-level is at least 2

if (APlayerData[playerid][PlayerLevel] >= 2)

{

if (sscanf(params, "uiis[128]", PlayerToBan, Days, Hours, Reason))

SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/ban <PlayerToBan> <Days> <Hours> <Reason>\"");

else

{

if (IsPlayerConnected(PlayerToBan))

{

// Get the names of the player and the admin who executed the ban

GetPlayerName(playerid, AdminName, sizeof(AdminName));

GetPlayerName(PlayerToBan, Name, sizeof(Name));

// Increase the number of bans

APlayerData[PlayerToBan][bans]++;

// Calculate the total bantime (when the player can login again)

TotalBanTime = (Days * 86400) + (Hours * 3600) + gettime();

// Check if this is the player's 5th ban

if (APlayerData[PlayerToBan][bans] == 3)

APlayerData[PlayerToBan][banTime] = 2147483640; // Make the ban permanent (as high as it can go)

else

APlayerData[PlayerToBan][banTime] = TotalBanTime; // Store this value for the player

// Inform the player about his ban

// Check if this is the player's 5th ban

if (APlayerData[PlayerToBan][bans] == 5)

{

format(Msg, 128, "You have been banned permanently by %s, this was your 3th ban", AdminName);

SendClientMessage(PlayerToBan, 0x808080FF, Msg);

}

else

{

format(Msg, 128, "You have been temponarlity banned by %s for %i days and %i hours", AdminName, Days, Hours);

SendClientMessage(PlayerToBan, 0x808080FF, Msg);

format(Msg, 128, "Reason: %s", Reason);

SendClientMessage(PlayerToBan, 0x808080FF, Msg);

format(Msg, 128, "You've been banned %i times now, 3th time is permament", APlayerData[PlayerToBan][bans]);

SendClientMessage(PlayerToBan, 0x808080FF, Msg);

}

// Kick the player (his data will be saved)

Kick(PlayerToBan);

// Inform everybody else which player was banned and for how long

format(Msg, 128, "%s %s has temponarlity banned %s for %i days and %i hours", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, Name, Days, Hours);

SendClientMessageToAll(0x808080FF, Msg);

}

}

}

else

    return 0;

}

else

    return 0;

return 1;

}[/pawn]

560x95_F01616_1625F2_030303_000000.png
Link to comment
Share on other sites

Ia aici comanda de pe gmul ce ti-am spus

[pawn]if(strcmp(cmd,"/tban", true) == 0)

{

if(PlayerInfo[playerid][pAdmin] >=9)

{

    new tmp2[256];

tmp=strtok(cmdtext,idx);

tmp2=strtok(cmdtext,idx);

if((!strlen(tmp)) || (!strlen(tmp2)) || (!IsNumeric(tmp)) || (!IsNumeric(tmp2)))

{

SendClientMessage(playerid,COLOR_GREY,"{FFA500}*Command:{ffffff} /tban [id] [days] [reason]");

    return 1;

}

if(IsPlayerConnected(playerid))

{

    new playeri,day,y,m,d,yy,mm,dd,nameme[MAX_PLAYER_NAME];

playeri = strval(tmp);

day = strval(tmp2);

if(IsPlayerConnected(playeri))

{

        if(UsedPBan[playerid] > 0)

{

  SendClientMessage(playerid, COLOR_WHITE, "Asteapta 2 minute");

    return 1;

}

if(day <= 0)

{

    SendClientMessage(playerid,COLOR_GREY,"Trebuie macar o zi sa banezi acel player!");

return 1;

}

new length = strlen(cmdtext);

while ((idx < length) && (cmdtext[idx] <= ' '))

{

idx++;

}

new offset = idx; // by Extazy and update by Flashin - Andrew Stanov.

new result[64];

while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))

{

result[idx - offset] = cmdtext[idx];

idx++;

}

result[idx - offset] = EOS;

GetPlayerName(playeri,nameme,sizeof(nameme));

GetPlayerName(playerid,playername,sizeof(playername));

    GetPlayerName(playeri,sendername,sizeof(sendername));

                    if(!strlen(result))

{

format(string,sizeof(string),"AdmCmd: %s a fost banat de catre %s. Motiv: %s ,pentru:(%d) zile.",playername,sendername,(result),day);

SendClientMessageToAll(COLOR_LIGHTRED,string);

}

else

{

    format(string,sizeof(string),"AdmCmd: %s was banned by %s, reason: %s ,for:(%d) Days.",playername,sendername,(result),day);

SendClientMessageToAll(COLOR_LIGHTRED,string);

}

getdate(y,m,d);

dd = d;

mm = m;

yy = y;

dd = dd + day;

while(dd > GetDayMount(m,y))

{

    mm++;

        if(mm > 12)

{

        mm=1;

        yy++;

        }

        dd = dd-GetDayMount(mm,yy);

}

format(string,sizeof(string),"%d,%d,%d",dd,mm,yy);

new File = iniOpen("tempbans.ini");

iniSet(File,nameme,string);

iniClose(File);

UsedPBan[playerid] = 1;

Kick(playeri);

}

else

{

    SendClientMessage(playerid,COLOR_GREY,"Nu este conectat!");

}

}

}

else

{

    SendClientMessage(playerid,COLOR_GREY,"You are not autorized!");

}

    return 1;

}[/pawn]

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.