Disabling Commands .. ?
#1

Ey' guys. I was wondering If you can disable a command, I'm making a CnR (which will be a lot different to previous CnR's). I want a 2 (120s) minute timer which I can create myself to re-enable the command. Does anybody know and / or have experience with this?
Reply
#2

umm do you mean like this?:
pawn Код:
new cmdUsed[MAX_PLAYERS];

OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/command", true)==0)
{
if(cmdUsed[playerid]) return SendClientMessage(playerid, 0xFFFFFFFF, "You must wait 2 minutes before using the cmd again.");
// do the command thing here and...
cmdUsed[playerid] = 1;
SetTimerEx("resetCmd", 120000, 0, "i");
return 0;
}
return 0;
}

public resetCmd(i)
{
cmdUsed[i] = 0;
}
Reply
#3

Quote:
Originally Posted by Thanatos
umm do you mean like this?:
pawn Код:
new cmdUsed[MAX_PLAYERS];

OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/command", true)==0)
{
if(cmdUsed[playerid]) return SendClientMessage(playerid, 0xFFFFFFFF, "You must wait 2 minutes before using the cmd again.");
// do the command thing here and...
cmdUsed[playerid] = 1;
SetTimerEx("resetCmd", 120000, 0, "i");
return 0;
}
return 0;
}

public resetCmd(i)
{
cmdUsed[i] = 0;
}
That works fine, thanks.
Reply
#4

no problem :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)