SA-MP Forums Archive
[help]/block command - 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: [help]/block command (/showthread.php?tid=150593)



[help]/block command - [asg]davo - 26.05.2010

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


Re: [help]/block command - [asg]davo - 27.05.2010

Can someone plz help


Re: [help]/block command - Conroy - 27.05.2010

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


Re: [help]/block command - [asg]davo - 27.05.2010

It will mute the person from talking to u


Re: [help]/block command - [asg]davo - 27.05.2010

Someone help


Re: [help]/block command - Conroy - 27.05.2010

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



Re: [help]/block command - [asg]davo - 27.05.2010

Thankyou thankyou where did u get this

I'm goin to add it 2morrow


Re: [help]/block command - Conroy - 27.05.2010

I created it.


Re: [help]/block command - [asg]davo - 27.05.2010

Ok thx thx thx ur awesome

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


Re: [help]/block command - Conroy - 27.05.2010

No it stops the player from talking to anyone.