24.12.2018, 21:45
Yes, of course!
So , lets edit the code I wrote up a lil bit:
So , lets edit the code I wrote up a lil bit:
PHP код:
#include <sscanf2>
#include <zcmd>
#define MAX_BLOCKED_USERS 2
new pBlockedID[MAX_PLAYERS][2];
public OnPlayerConnect(playerid)
{
pBlockedID[playerid][0] = -1; // Reset the variables when player connect to the server
pBlockedID[playerid][1] = -1;
return 1;
}
CMD:blockplayer(playerid, params[])
{
new id;
if(sscanf(params, "u", id) return SendClientMessage(playerid, -1, "Syntax: /blockplayer <id/playername>");
if(pBlockedID[playerid][0] == -1)
{
pBlockedID[playerid][0] = id;
}
else if(pBlockedID[playerid][1] == -1)
{
pBlockedID[playerid][0] = id;
}
else return SCM(playerid, -1, "You used all slots for blocked players.");
SendClientMessage(playerid, -1, "You blocked successfully the player!");
}
public OnPlayerText(playerid, text[])
{
foreach(new i: Player)
{
if(i==pBlockedID[playerid][0] || pBlockedID[playerid][1])// checks if the player who send message is blocked
{
return 1;
}
else SendClientMessage(i, COLOR, text);
}
return 0;
}