Jump to content
  • 0

/ban


gabbii

Question

Cum pot face comanda /ban sa nu poti da ban la un admin de level mai mare?

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

{

    if(IsPlayerConnected(playerid))

    {

    tmp = strtok(cmdtext, idx);

if(!strlen(tmp))

{

SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] [reason]");

return 1;

}

giveplayerid = ReturnUser(tmp);

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, "USAGE: /ban [playerid/PartOfName] [reason]");

return 1;

}

if(bantime[playerid] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "Are you trying to ban this server?");

new year, month,day;

getdate(year, month, day);

format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);

BanLog(string);

format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", giveplayer, sendername, (result));

SendClientMessageToAll(COLOR_LIGHTRED, string);

                        new playersip[256];

GetPlayerIp(giveplayerid,playersip, sizeof(playersip));

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

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

                        SendClientMessage(giveplayerid, COLOR_RED, string);

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

                        SendClientMessage(giveplayerid, COLOR_RED, string);

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

                        SendClientMessage(giveplayerid, COLOR_RED, string);

                        format(string, sizeof(string), "Motiv: %s.",(result));

                        SendClientMessage(giveplayerid, COLOR_RED, string);

                        format(string, sizeof(string), "Data: %d/%d/%d",day,month,year);

                        SendClientMessage(giveplayerid, COLOR_RED, string);

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

                        bantime[playerid] = 1;

            SetTimerEx("bant", 10000, 0, "%d", playerid);

                        PlayerInfo[giveplayerid][pLocked] = 1;

Ban(giveplayerid);

return 1;

}

}//not connected

}

else

{

format(string, sizeof(string), "  %d is not an active player.", giveplayerid);

SendClientMessage(playerid, COLOR_GRAD1, string);

}

}

return 1;

}[/pawn]

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

Asa:

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

{

    if(IsPlayerConnected(playerid))

    {

    tmp = strtok(cmdtext, idx);

if(!strlen(tmp))

{

SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] [reason]");

return 1;

}

giveplayerid = ReturnUser(tmp);

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

{

    if(IsPlayerConnected(giveplayerid))

    {

        if(giveplayerid != INVALID_PLAYER_ID)

        {

                                        if (PlayerInfo[giveplayerid][pAdmin] < PlayerInfo[giveplayerid][pAdmin])

                                        {

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, "USAGE: /ban [playerid/PartOfName] [reason]");

return 1;

}

if(bantime[playerid] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "Are you trying to ban this server?");

new year, month,day;

getdate(year, month, day);

format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);

BanLog(string);

format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", giveplayer, sendername, (result));

SendClientMessageToAll(COLOR_LIGHTRED, string);

                        new playersip[256];

GetPlayerIp(giveplayerid,playersip, sizeof(playersip));

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

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

                        SendClientMessage(giveplayerid, COLOR_RED, string);

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

                        SendClientMessage(giveplayerid, COLOR_RED, string);

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

                        SendClientMessage(giveplayerid, COLOR_RED, string);

                      format(string, sizeof(string), "Motiv: %s.",(result));

                        SendClientMessage(giveplayerid, COLOR_RED, string);

                      format(string, sizeof(string), "Data: %d/%d/%d",day,month,year);

                        SendClientMessage(giveplayerid, COLOR_RED, string);

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

                        bantime[playerid] = 1;

            SetTimerEx("bant", 10000, 0, "%d", playerid);

                        PlayerInfo[giveplayerid][pLocked] = 1;

Ban(giveplayerid);

return 1;

}

}//not connected

}

else

{

format(string, sizeof(string), "  %d is not an active player.", giveplayerid);

SendClientMessage(playerid, COLOR_GRAD1, string);

}

}

else

{

SendClientMessage( playerid, COLOR_GRAD1, "You can not ban a Player with a Big Admin." );

}

}

return ( 1 );

}[/pawn]

142sj0l.png

Underground-GFX

Link to comment
Share on other sites

imi da erorile astea

D:\Internet\Server Sa-Mp\samp03csvr_R2-2_win32\gamemodes\mz.pwn(37249) : error 029: invalid expression, assumed zero
D:\Internet\Server Sa-Mp\samp03csvr_R2-2_win32\gamemodes\mz.pwn(37249) : error 001: expected token: ")", but found ";"
D:\Internet\Server Sa-Mp\samp03csvr_R2-2_win32\gamemodes\mz.pwn(37249) : error 036: empty statement
D:\Internet\Server Sa-Mp\samp03csvr_R2-2_win32\gamemodes\mz.pwn(37249) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.

Link to comment
Share on other sites

si mai am nevoie de ajutor la comanda /unban numi scoate banul...:(

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

    {

        if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 1337)

        {

            tmp = strtok(cmdtext, idx);

            if(!strlen(tmp))

            {

                SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /unban [PlayerName]");

                return 1;

            }

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

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

            format(string, 256, "AdmWarning: %s has unbanned %s", sendername,tmp);

            ABroadCast(COLOR_YELLOW,string,1);

            format(string, 256, "AdmWarning: %s has unbanned %s", sendername,tmp);

            printf(string);

            format(string,sizeof(string),"%s.ini",tmp);

            fremove(string);

            SendClientMessage(playerid, COLOR_GRAD1, "Player Unbanned");

        }

        return 1;

    }[/pawn]

Link to comment
Share on other sites

si mai am nevoie de ajutor la comanda /unban numi scoate banul...:(

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

    {

        if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 1337)

        {

            tmp = strtok(cmdtext, idx);

            if(!strlen(tmp))

            {

                SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /unban [PlayerName]");

                return 1;

            }

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

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

            format(string, 256, "AdmWarning: %s has unbanned %s", sendername,tmp);

            ABroadCast(COLOR_YELLOW,string,1);

            format(string, 256, "AdmWarning: %s has unbanned %s", sendername,tmp);

            printf(string);

            format(string,sizeof(string),"%s.ini",tmp);

            fremove(string);

            SendClientMessage(playerid, COLOR_GRAD1, "Player Unbanned");

        }

        return 1;

    }[/pawn]

format(string,sizeof(string),"%s.ini",tmp);
vezi ca poate conturle se salveaza intr-un fisier anume, daca da atunci faci:
format(string,sizeof(string),"Users/%s.ini",tmp);

Link to comment
Share on other sites

Si cu comanda /ban cum o pot face sa nu poti da ban la un admin de level mai mare?

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

{

    if(IsPlayerConnected(playerid))

    {

    tmp = strtok(cmdtext, idx);

if(!strlen(tmp))

{

SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] [reason]");

return 1;

}

giveplayerid = ReturnUser(tmp);

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, "USAGE: /ban [playerid/PartOfName] [reason]");

return 1;

}

if(bantime[playerid] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "Are you trying to ban this server?");

new year, month,day;

getdate(year, month, day);

format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);

BanLog(string);

format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", giveplayer, sendername, (result));

SendClientMessageToAll(COLOR_LIGHTRED, string);

                        new playersip[256];

GetPlayerIp(giveplayerid,playersip, sizeof(playersip));

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

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

                        SendClientMessage(giveplayerid, COLOR_RED, string);

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

                        SendClientMessage(giveplayerid, COLOR_RED, string);

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

                        SendClientMessage(giveplayerid, COLOR_RED, string);

                        format(string, sizeof(string), "Motiv: %s.",(result));

                        SendClientMessage(giveplayerid, COLOR_RED, string);

                        format(string, sizeof(string), "Data: %d/%d/%d",day,month,year);

                        SendClientMessage(giveplayerid, COLOR_RED, string);

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

                        bantime[playerid] = 1;

            SetTimerEx("bant", 10000, 0, "%d", playerid);

                        PlayerInfo[giveplayerid][pLocked] = 1;

Ban(giveplayerid);

return 1;

}

}//not connected

}

else

{

format(string, sizeof(string), "  %d is not an active player.", giveplayerid);

SendClientMessage(playerid, COLOR_GRAD1, string);

}

}

return 1;

}

[/pawn]

Link to comment
Share on other sites

[pawn]

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

{

    if(IsPlayerConnected(playerid))

    {

    tmp = strtok(cmdtext, idx);

if(!strlen(tmp))

{

SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] [reason]");

return 1;

}

giveplayerid = ReturnUser(tmp);

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

{

    if(IsPlayerConnected(giveplayerid))

    {

        if(giveplayerid != INVALID_PLAYER_ID)

        {

            if(PlayerInfo[giveplayerid][pAdmin] > 0)

            {

SendClientMessage(playerid, 0xFFFFFF, "Can't ban that player.");

return 1;

}

    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, "USAGE: /ban [playerid/PartOfName] [reason]");

return 1;

}

if(bantime[playerid] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "Are you trying to ban this server?");

new year, month,day;

getdate(year, month, day);

format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);

BanLog(string);

format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", giveplayer, sendername, (result));

SendClientMessageToAll(COLOR_LIGHTRED, string);

                        new playersip[256];

GetPlayerIp(giveplayerid,playersip, sizeof(playersip));

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

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

                        SendClientMessage(giveplayerid, COLOR_RED, string);

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

                        SendClientMessage(giveplayerid, COLOR_RED, string);

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

                        SendClientMessage(giveplayerid, COLOR_RED, string);

                        format(string, sizeof(string), "Motiv: %s.",(result));

                        SendClientMessage(giveplayerid, COLOR_RED, string);

                        format(string, sizeof(string), "Data: %d/%d/%d",day,month,year);

                        SendClientMessage(giveplayerid, COLOR_RED, string);

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

                        bantime[playerid] = 1;

            SetTimerEx("bant", 10000, 0, "%d", playerid);

                        PlayerInfo[giveplayerid][pLocked] = 1;

Ban(giveplayerid);

return 1;

}

}//not connected

}

else

{

format(string, sizeof(string), "  %d is not an active player.", giveplayerid);

SendClientMessage(playerid, COLOR_GRAD1, string);

}

}

return 1;

}[/pawn]

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.