Jump to content
  • 0

Comanda /ban


Octav97

Question

8 answers to this question

Recommended Posts

[pawn]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 3

if (APlayerData[playerid][PlayerLevel] >=Aici pui la ce level de admin sa fie comanda)

{

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] == 5)

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 5th ban", AdminName);

SendClientMessage(PlayerToBan, 0x808080FF, Msg);

}

else

{

format(Msg, 128, "You have been 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, 5th 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 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]

Sper ca ti-am fost de folos

<a href="http://www.game-state.eu/188.212.105.161:7777/"><img src="http://www.game-state.eu/188.212.105.161:7777/430x73_FFFFFF_FF9900_000000_000000.png" alt="www.Game-State.eu" style="border-style: none;" /></a>

Link to comment
Share on other sites

Am adaugat alea si uite mi-a dat niste erori!

D:\Server\gamemodes\gf.pwn(17137) : error 017: undefined symbol "ban"

D:\Server\gamemodes\gf.pwn(17137) : error 033: array must be indexed (variable "-unknown-")

D:\Server\gamemodes\gf.pwn(17137) : error 029: invalid expression, assumed zero

D:\Server\gamemodes\gf.pwn(17137) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

4 Errors.

De ce oare???

Link to comment
Share on other sites

dami linia asta 17137

<a href="http://www.game-state.eu/188.212.105.161:7777/"><img src="http://www.game-state.eu/188.212.105.161:7777/430x73_FFFFFF_FF9900_000000_000000.png" alt="www.Game-State.eu" style="border-style: none;" /></a>

Link to comment
Share on other sites

e comanda mea /ban: 

if(strcmp(cmd, "/ban", true) == 0)

{

    if(IsPlayerConnected(playerid))

    {

    tmp = strtok(cmdtext, idx);

if(!strlen(tmp))

{

SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}USAGE{FFFFFF}: /ban [playerid/PartOfName] [reason]");

return 1;

}

giveplayerid = ReturnUser(tmp);

if ((!banss) && (PlayerInfo[playerid][pAdmin] > 0))

{

format(string, sizeof(string), "  Please try again later %d seconds between Warnings!",  (addtimer/1000));

SendClientMessage(playerid, COLOR_GRAD2, string);

return 1;

}

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

{

    if(IsPlayerConnected(giveplayerid))

    {

        if(giveplayerid != INVALID_PLAYER_ID)

        {

    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));

GetPlayerName(playerid, sendername, sizeof(sendername));

new length = strlen(cmdtext);

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

{

idx++;

}

new offset = idx;

new result[64];

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

{

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

idx++;

}

              result[idx - offset] = EOS;

if(!strlen(result))

{

SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}USAGE{FFFFFF}: /ban [playerid/PartOfName] [reason]");

return 1;

}

if(PlayerInfo[giveplayerid][pAdmin] >= 1)

                        {

                SendClientMessage(playerid,COLOR_GREY,"That player can not be banned");

                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));

                            GetPlayerName(playerid, sendername, sizeof(sendername));

                  format(string, 128, "AdmWarning: %s incearca comanda /ban pe un admin", sendername);

                  ABroadCast(COLOR_YELLOW,string,1);

                  return 1;

            }

new year, month,day;

getdate(year, month, day);

format(string, sizeof(string), "AdmCmd: %s a fost banat de Admin %s, motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);

BanLog(string);

format(string, sizeof(string), "AdmCmd: %s a fost banat de Admin %s, motiv: %s", giveplayer, sendername, (result));

SendClientMessageToAll(COLOR_LIGHTRED, string);

PlayerInfo[giveplayerid][pLocked] = 1;

new plrIP[16];

GetPlayerIp(giveplayerid,plrIP, sizeof(plrIP));

    SendClientMessage(giveplayerid,COLOR_DBLUE,"|___________[bAN INFO]___________|");

            format(string, sizeof(string), "Numele tau este: %s.",giveplayer);

                        SendClientMessage(giveplayerid, COLOR_WHITE, string);

                        format(string, sizeof(string), "IP-ul tau este: %s.",plrIP);

                        SendClientMessage(giveplayerid, COLOR_WHITE, string);

                        format(string, sizeof(string), "Ai fost banat de: %s.",sendername);

                        SendClientMessage(giveplayerid, COLOR_WHITE, string);

                        format(string, sizeof(string), "Ai fost banat pentru urmatorul motiv: %s.",(result));

                        SendClientMessage(giveplayerid, COLOR_WHITE, string);

                        format(string, sizeof(string), "Ai fost banat pe data de: %d/%d/%d (Ziua-Luna-Anul)",day,month,year);

                        SendClientMessage(giveplayerid, COLOR_WHITE, string);

                        SendClientMessage(giveplayerid,COLOR_DBLUE,"|___________[bAN INFO]___________|");

                        SendClientMessage(giveplayerid,COLOR_LIGHTRED,"[bAN INFO]: Poti face o cerere de unban pe forumul nostru.Forumul este www.InsidePlay.net/forum .Succes !");

                        SendClientMessage(giveplayerid,COLOR_WHITE,"[HINT]: Te sfatuim sa faci o poza la aceste informatii,si sa o postezi cand faci cerere unban.Apasa F8 pentru a face poza !");

Ban(giveplayerid);

SetTimer("BansOn", banstimer, false);

banss = 0;

return 1;

}

}//not connected

}

else

{

format(string, sizeof(string), "Playerul nu este pe server.", giveplayerid);

SendClientMessage(playerid, COLOR_GRAD1, string);

}

}

return 1;

}

Link to comment
Share on other sites

[pawn]if (strcmp("/ban", cmdtext, true, 6) == 0)

{

// 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 3

if (APlayerData[playerid][PlayerLevel] >=Aici pui la ce level de admin sa fie comanda)

{

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] == 5)

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 5th ban", AdminName);

SendClientMessage(PlayerToBan, 0x808080FF, Msg);

}

else

{

format(Msg, 128, "You have been 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, 5th 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 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]

nu ma prea pricep la strcmp incearca acum :)

<a href="http://www.game-state.eu/188.212.105.161:7777/"><img src="http://www.game-state.eu/188.212.105.161:7777/430x73_FFFFFF_FF9900_000000_000000.png" alt="www.Game-State.eu" style="border-style: none;" /></a>

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.