SA-MP Forums Archive
how can i make a cmd if(ban,smokey619,reason)=ban yourself - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: how can i make a cmd if(ban,smokey619,reason)=ban yourself (/showthread.php?tid=104533)



how can i make a cmd if(ban,smokey619,reason)=ban yourself - Smokey619 - 25.10.2009

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?


Re: how can i make a cmd if(ban,smokey619,reason)=ban yourself - Smokey619 - 26.10.2009

does anyone know?


Re: how can i make a cmd if(ban,smokey619,reason)=ban yourself - bigcomfycouch - 26.10.2009

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


Re: how can i make a cmd if(ban,smokey619,reason)=ban yourself - Peter_Corneile - 26.10.2009

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;
    }



Re: how can i make a cmd if(ban,smokey619,reason)=ban yourself - Abernethy - 26.10.2009

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))


Re: how can i make a cmd if(ban,smokey619,reason)=ban yourself - Correlli - 26.10.2009

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


Re: how can i make a cmd if(ban,smokey619,reason)=ban yourself - SpiderPork - 26.10.2009

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.