11.08.2015, 19:21
Aqui te va un ejemplo.
Cuando comandos estan bloqueados, solamente puedes utilizar /test1.
P.S: No estamos ciegos!
Cuando comandos estan bloqueados, solamente puedes utilizar /test1.
pawn Код:
// [ DEVELOPMENT GAMEMODE ]
// INCLUDES:
#include <a_samp>
#include <zcmd>
// DEFINES:
// FUNCTIONS:
#define function%0(%1) forward%0(%1); public%0(%1)
// PER-PLAYER VARIABLES:
new bool:pCommandsBlocked[MAX_PLAYERS] = false;
// MAIN:
main()
{
print("Development Mode: block_cmds_leave_one.amx");
}
// CALLBACKS:
public OnGameModeInit()
{
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if(ArePlayerCommandsBlocked(playerid))
{
if(strcmp(cmdtext, "/test1", true) != 0)
{
SendClientMessage(playerid, -1, "Commands are currently blocked.");
return 0;
}
}
return 1;
}
// COMMANDS:
CMD:blockcmds(playerid, params[])
{
pCommandsBlocked[playerid] = true;
return 1;
}
CMD:unblockcmds(playerid, params[])
{
pCommandsBlocked[playerid] = false;
return 1;
}
CMD:test1(playerid, params[])
{
SendClientMessage(playerid, -1, "You have used the commad /test1.");
return 1;
}
CMD:test2(playerid, params[])
{
SendClientMessage(playerid, -1, "You have used the commad /test2.");
return 1;
}
// FUNCTIONS:
function bool:ArePlayerCommandsBlocked(playerid) return pCommandsBlocked[playerid];