SetTimerEx
#8

Quote:
Originally Posted by jakejohnsonusa
Посмотреть сообщение
Oh, whoops!

I forgot to add the "new"... Now here this should work:

Add this to the top of your script:

pawn Код:
forward PickedUpPickupReset(playerid);//Timer prepertaion or the "forward"
new PickedUpPickup[MAX_PLAYERS] = 0;//Variable to hold if the player has picked somthing up. 0 = No, 1 = Yes
Add this to the OnPlayerPickUpPickupin your script (Obviously don't copy the public OnPlayerPickUpPickup part if you already have it):
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
      if(PickedUpPickup[playerid] != 0)//If they have picked up a pickup...
      {
            SendClientMessage(playerid, -1, "* You need to wait at least 5 seconds before picking up another pickup!");
            return 1;//Ends the code, not allowing the pickup.
      }
      PickedUpPickup[playerid] = 1;//Sets the 'PickedUpPickup' variable to has picked somthing up.
      SetTimerEx("PickedUpPickupReset", 4500, false, "i", playerid);//Sets a timer to reset the 'PickedUpPickup' variable to 0... 4.5 seconds.
}

Then add this to the end of your script:
pawn Код:
public PickedUpPickupReset (playerid)//The timer that resets the variable 'PickedUpPickup' to 0 (Nothing picked up within 4.5 seconds).
{
      PickedUpPickup[playerid] = 0;
      return 1;
}
Now I hope it helps you! And +1 as soon as I am allowed to give the next reputation point, again good job for trying to learn!
Same here, +1 for again helping me. Thank you!
Reply


Messages In This Thread
SetTimerEx - by CesarLT - 22.09.2013, 23:03
Re: SetTimerEx - by DanishHaq - 22.09.2013, 23:07
Re: SetTimerEx - by CesarLT - 22.09.2013, 23:09
Re: SetTimerEx - by jakejohnsonusa - 23.09.2013, 01:05
Re: SetTimerEx - by CesarLT - 23.09.2013, 01:46
Re: SetTimerEx - by jakejohnsonusa - 23.09.2013, 01:51
AW: SetTimerEx - by BigETI - 23.09.2013, 03:49
Re: SetTimerEx - by CesarLT - 23.09.2013, 09:46

Forum Jump:


Users browsing this thread: 1 Guest(s)