Imma give you some examples from my script
Kick:
PHP код:
COMMAND:kick(playerid, params[])
{
new id;
if(IsPlayerConnected(id))
{
if(PlayerInfo[playerid][AdminLevel] >= 3)
{
if(!sscanf(params, "u", id))
{
new string[64];
new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(id, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "You Have Been Kicked By %s.", name);
SendClientMessage(id, 0xD8D8D8FF, string);
format(string, sizeof(string), "You Kicked %s .", id);
SendClientMessage(playerid, 0xD8D8D8FF, string);
Kick(id);
return 1;
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "System: /kick [PlayerId/PartOfName]");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "Your Not High Enough Level To Use This Command.");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "Player is not connected.");
}
Ban:
PHP код:
COMMAND:ban(playerid, params[])
{
new id;
if(IsPlayerConnected(id))
{
if(PlayerInfo[playerid][AdminLevel] >= 4)
{
if(!sscanf(params, "u", id))
{
new string[64];
new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(id, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "You Have Been Banned By %s.", name);
SendClientMessage(id, 0xD8D8D8FF, string);
format(string, sizeof(string), "You Banned %s .", id);
SendClientMessage(playerid, 0xD8D8D8FF, string);
Ban(id);
return 1;
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "System: /ban [PlayerId/PartOfName]");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "Your Not High Enough Level To Use This Command.");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "Player is not connected.");
}
Announce:
PHP код:
COMMAND:announce(playerid,params[])
{
{
if(PlayerInfo[playerid][AdminLevel] >= 4) {
new
poster[40],
mess[128];
sscanf(params,"s",mess);
if(!isnull(mess)) {
new text[128];
GetPlayerName(playerid,poster,sizeof(poster));
format(text,sizeof(text),"Administrator \"%s\" has announced his message. (%s)",poster,mess);
SendClientMessageToAll(0xD8D8D8FF,text);
GameTextForAll(mess,5000,3);
new Float:pX, Float:pY, Float:pZ;
PlayerPlaySound(playerid,1057,pX,pY,pZ);
}
else {
return SendClientMessage(playerid,red,"USAGE: /announce [message], and all players will see this message on-screen.");
}
}
else {
return SendClientMessage(playerid,red,"You are not allowed to use this command.");
}
return 1;
}
}