how can i make a cmd if(ban,smokey619,reason)=ban yourself
#1

well i want to make a command where a admin in my server tries to ban me they get their self banned. how can i make a command like that?
Reply
#2

does anyone know?
Reply
#3

Код:
if(!strcmp(tmp, "smokey619", true))
{
	SendClientMessage(playerid, COLOR_YELLOW, "You've attempted to ban Smokey619. Nice try!");
	Ban(playerid);
	return 1;
}
might work
Reply
#4

pawn Код:
if(strcmp( "/ban",cmdtext ,true,4) == 0)
    {
    if(IsPlayerAdmin(playerid))
    {
    Ban(playerid);
    new string[256];
    new Banned[MAX_PLAYER_NAME];
    GetPlayerName(playerid,Banned,sizeof(Banned));
    format(string,sizeof(string),"%s tried to ban someone and got himself/herself banned",Banned);
    SendClientMessageToAll(COLOR,string);

    }
    else
    {
    SendClientMessage(playerid,Color,"Youre not an Rcon Admin");
    }
    return 1;
    }
Reply
#5

Quote:
Originally Posted by ►Peter Corneile◄ [ideal-host.co.uk
]
pawn Код:
if(strcmp( "/ban",cmdtext ,true,4) == 0)
    {
    if(IsPlayerAdmin(playerid))
    {
    Ban(playerid);
    new string[256];
    new Banned[MAX_PLAYER_NAME];
    GetPlayerName(playerid,Banned,sizeof(Banned));
    format(string,sizeof(string),"%s tried to ban someone and got himself/herself banned",Banned);
    SendClientMessageToAll(COLOR,string);

    }
    else
    {
    SendClientMessage(playerid,Color,"Youre not an Rcon Admin");
    }
    return 1;
    }
Ah, that would ban yourself if you were an admin.
Use if (!IsPlayerAdmin(playerid))
Reply
#6

And don't use 256 cells when you don't need them.
Reply
#7

Quote:
Originally Posted by ►Peter Corneile◄ [ideal-host.co.uk
]
pawn Код:
if(strcmp( "/ban",cmdtext ,true,4) == 0)
    {
    if(IsPlayerAdmin(playerid))
    {
    Ban(playerid);
    new string[256];
    new Banned[MAX_PLAYER_NAME];
    GetPlayerName(playerid,Banned,sizeof(Banned));
    format(string,sizeof(string),"%s tried to ban someone and got himself/herself banned",Banned);
    SendClientMessageToAll(COLOR,string);

    }
    else
    {
    SendClientMessage(playerid,Color,"Youre not an Rcon Admin");
    }
    return 1;
    }
This will not send the correct message, you should get the player's name before banning him/her.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)