Help needed of an advanced scripter
#1

how can I create a script that disables a command with a timer,
for example:
Код:
if(!strcmp("/warusa", cmdtext, true))
{
	SetPlayerPos(playerid,2525,-1893,14);
	SetPlayerFacingAngle(playerid,180);
}
that the timer does that command turn off

thnx for your help
Reply
#2

Add an if-statement in the command to determine if the timer has disabled the command.
Reply
#3

pawn Код:
if(!strcmp("/warusa", cmdtext, true))
{
    if(GetPVarInt(playerid,"DisabledCMD") == 1) return SendClientMessage(playerid,COLOR_RED,"You can't use this command, you just used it!");
    SetPlayerPos(playerid,2525,-1893,14);
    SetPlayerFacingAngle(playerid,180);
    SetPVarInt(playerid,"DisabledCMD",1);
    SetTimer("DisabledCMD,your_time_here,0); //change the your_time_here to your time!
}
forward DisabledCMD(playerid);
public DisabledCMD(playerid)
{
    SetPVarInt(playerid,"
DisabledCMD",0);
    SendClientMessage(playerid,COLOR_GREEN,"
You can use the command again!");
}
Not tested, please tell me if it worked
Reply
#4

well i think i have something but i have no time to compile so!
pawn Код:
native IsCommandLocked(something);
forward Command();

public Command()
{
    IsCommandLocked(1);
    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/commandlock", cmdtext, true))
    {
        SetTimer("Command", 10000, false);
    }
    if(!strcmp("/warusa", cmdtext, true))
    {
        if (IsCommandLocked(0))
        {
            SetPlayerPos(playerid,2525,-1893,14);
            SetPlayerFacingAngle(playerid,180);
        }
        else
        {
            SendClientMessage(playerid,0xFFFFFFFF,"LALALALA");
        }
    }
    return 0;
}
i dont even know if it work just try
Reply
#5

thnx Jari_Johnson* it works your a great,.,.,

thnx for helping all!! im so happy
Reply
#6

Quote:
Originally Posted by speediekiller2
Посмотреть сообщение
thnx Jari_Johnson* it works your a great,.,.,

thnx for helping all!! im so happy
Your'e welcome
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)