[help]/block command
#1

Ok can anyone plz tell me how to make a /block command

so likeu right /block [idofplayer]

- /block cannot be used on admins, admins cannot be blocked.
- Admins have to get a message saying who blocked who.

Thx
plz help
Reply
#2

Can someone plz help
Reply
#3

What will the command do? What's the purpose of blocking someone?
Reply
#4

It will mute the person from talking to u
Reply
#5

Someone help
Reply
#6

pawn Код:
new PlayerBlocked[MAX_PLAYERS];
pawn Код:
if(strcmp(cmd, "/block", true) == 0)
{
new tmp[20], id;
tmp = strtok(cmdtext, index);
if(!IsPlayerAdmin(playerid)) return 0;
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_ERROR, "USAGE: /block [ID]");
id = strval(tmp);
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: Player is not connected");
if(id == playerid) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You cannot use this command on yourself");
if(IsPlayerAdmin(id)) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You cannot use this command on other admins");
if(PlayerBlocked[id] == 1) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: Player is already blocked");
PlayerBlocked[id] = 1;
SendClientMessage(id, COLOR_RED, "You have been blocked");
new message[128], blockedname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME];
GetPlayerName(id, blockedname, sizeof(blockedname));
GetPlayerName(playerid, adminname, sizeof(adminname));
format(message,sizeof(message), "%s has been blocked by admin %s", blockedname, adminname);
for(new i; i<MAX_PLAYERS; i++) {
if(IsPlayerAdmin(i)) {
SendClientMessage(i, COLOR_RED, message);
}
}
return 1;
}
pawn Код:
if(strcmp(cmd, "/unblock", true) == 0)
{
new tmp[20], id;
tmp = strtok(cmdtext, index);
if(!IsPlayerAdmin(playerid)) return 0;
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_ERROR, "USAGE: /unblock [ID]");
id = strval(tmp);
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: Player is not connected");
if(id == playerid) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You cannot use this command on yourself");
if(IsPlayerAdmin(id)) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You cannot use this command on other admins");
if(PlayerBlocked[id] == 0) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: Player is already unblocked");
PlayerBlocked[id] = 0;
SendClientMessage(id, COLOR_GREEN, "You have been unblocked");
new message[128], blockedname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME];
GetPlayerName(id, blockedname, sizeof(blockedname));
GetPlayerName(playerid, adminname, sizeof(adminname));
format(message,sizeof(message), "%s has been unblocked by admin %s", blockedname, adminname);
for(new i; i<MAX_PLAYERS; i++) {
if(IsPlayerAdmin(i)) {
SendClientMessage(i, COLOR_RED, message);
}
}
return 1;
}
pawn Код:
public OnPlayerText(playerid, text[])
{
if(PlayerBlocked[playerid] == 1) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You cannot talk whilst blocked");
return 1;
}
Reply
#7

Thankyou thankyou where did u get this

I'm goin to add it 2morrow
Reply
#8

I created it.
Reply
#9

Ok thx thx thx ur awesome

and dies it stop the player from talkin to just the person who blocked them
Reply
#10

No it stops the player from talking to anyone.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)