04.09.2010, 12:37
Cleaner indention always helps. This method will work and is the most efficient way of handling it:
pawn Код:
dcmd_bslap(playerid,params[])
{
if(PlayerInfo[playerid][Level] < 3)
{
SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
return 1;
}
if(!strlen(params))
{
SendClientMessage(playerid, red, "USAGE: /bslap [playerid]");
return 1;
}
new player1 = strval(params);
if(!IsPlayerConnected(player1))
{
SendClientMessage(playerid,red,"ERROR: Player is not connected");
return 1;
}
if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
{
SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
return 1;
}
CMDMessageToAdmins(playerid,"BSLAP");
new string[128];
format(string, sizeof(string), "You have bslapped \"%s's\"", pName(player1));
SendClientMessage(playerid,blue,string);
SetPlayerPos(player1,0.0,0.0,2500.0);
SetPlayerHealth(player1,0.01);
if(player1 != playerid)
{
format(string,sizeof(string),"Administrator \"%s\" has bslapped you", pName(playerid));
SendClientMessage(player1,blue,string);
}
return 1;
}