#1

.....
Reply
#2

pawn Код:
// On top of the script
new CommandWaiting[MAX_PLAYERS];

// On the command

COMMAND:armour(playerid, params[])
{
      if(CommandWaiting[playerid] == 0);
     {
           CommandWaiting[playerid] = 1;
           SetPlayerArmour(playerid, 100);
           SetTimer("waiting", 180000, false);
     }
     else
         SendClientMessage(playerid, 0xAA3333AA, "You are allowed to use this command only 1 time every 3 minutes");
      return 1;
}

forward waiting(playerid);

public waiting(playerid)
{
      CommandWaiting[playerid] = 0;
      return 1;
}
I think this will work fine.

PS: To make it work, you'll need to use "zcmd" include to make this work, since I made the command with it.

Private200
Reply
#3

pawn Код:
new armour[MAX_PLAYERS];
CMD:armour(playerid)
{
//armour giveing codes
armour(playerid)=1;
SetTimer("Arming(playerid)",30000,0);
}
forward Arming(playerid);
public Arming(playerid)
{
armour(playerid)=0;
}
there may be errors but you need to do it like this way its just an example scripting after a long time so dont remmember the basic syntax's.
Reply
#4

Or you can use this
pawn Код:
CMD:armour(playerid,params[]) {
    if(GetPVarInt(playerid,"ABUSE")>GetTickCount())return SendMessageToPlayer(playerid,0xFF0000FF,"You must wait 3 minutes before using this command again");
    SetPVarInt(playerid,"ABUSE",GetTickCount()+180000);
    SetPlayerArmour(playerid,100.0);
    return 1;}
Reply
#5

Put this on top of your script (after includes)
PHP код:
forward timer_refillarmor(playerid);
new 
armortimer[MAX_PLAYERS]; 
This under OnPlayerConnect
PHP код:
armortimer[playerid] = 1
This under OnPlayerCommandText
PHP код:
if (strcmp("/armor"cmdtexttrue6) == 0)
{
     if(
armortimer[playerid] == 1)
    {
        
SetPlayerArmour(playerid,100);
        
SetTimer("timer_refillarmor",18000,false);
        
armortimer[playerid] = 0;
    }
    else
    {
           
SendClientMessage(playerid,0xFF0000FF,"You must wait 3 minutes before using /armor again!");
    }
    return 
1;

And, this on the bottom of your script (or somewhere else)
PHP код:
public timer_refillarmor(playerid)
{
    
armortimer[playerid] = 1;
    return 
1;

Reply
#6

~~~~~~
Reply
#7

No need to say something similar
Reply
#8

Can't understand why you don't just use the first one I gave you,,,

pawn Код:
// On top of the script
new CommandWaiting[MAX_PLAYERS];

// On the command

COMMAND:armour(playerid, params[])
{
      if(CommandWaiting[playerid] == 0);
     {
           CommandWaiting[playerid] = 1;
           SetPlayerArmour(playerid, 100);
           SetTimer("waiting", 180000, false);
     }
     else
         SendClientMessage(playerid, 0xAA3333AA, "You are allowed to use this command only 1 time every 3 minutes");
      return 1;
}

forward waiting(playerid);

public waiting(playerid)
{
      CommandWaiting[playerid] = 0;
      return 1;
}
Reply
#9

Yeah use Private200's code. Except he made a mistake that ill fix :P


pawn Код:
// On top of the script
new CommandWaiting[MAX_PLAYERS];

// On the command

COMMAND:armour(playerid, params[])
{
      if(CommandWaiting[playerid] == 0);
     {
           CommandWaiting[playerid] = 1;
           SetPlayerArmour(playerid, 100);
           SetTimerEx("waiting", 180000, false,"i",playerid);
     }
     else
         SendClientMessage(playerid, 0xAA3333AA, "You are allowed to use this command only 1 time every 3 minutes");
      return 1;
}

forward waiting(playerid);

public waiting(playerid)
{
      CommandWaiting[playerid] = 0;
      return 1;
}
fixed
Reply
#10

Vlad64 also made the same mistake..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)