SA-MP Forums Archive
[HELP] DestroyPickup(pickup); - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] DestroyPickup(pickup); (/showthread.php?tid=193246)



[HELP] DestroyPickup(pickup); - Larsey123IsMe - 25.11.2010

How can i set a time for DestroyPickup(pickup);

Example:

pawn Код:
//Health~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    if( pickupid == HealthPickup){
        if(IsPlayerAdmin(playerid)==1){
      SetPlayerHealth(playerid, 100);
      DestroyPickup(HealthPickup); //The pickup (Health) should show after 15 min
      PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
      SendClientMessage(playerid,COLOR_ORANGERED,"You picked up Health!");
        }
        else return SendClientMessage(playerid,COLOR_RED,"This Health restore is just for ARMY!");
    }
Like:

1. I go to the Health pickup
2. When i have entered the pick up, then it disappier
3. 15 Minutes after it gonna show again.


Re: [HELP] DestroyPickup(pickup); - ColdXX - 25.11.2010

Use SetTimerEx
https://sampwiki.blast.hk/wiki/SetTimerEx
For example u can set the timer to 5 seconds,that means that after 5 seconds u used a command or idk entered a CP something will happen,whatever u want to! (In this case DestroyPickup(HealthPickup);

Set the timer into your code
if(pickupid == HealthPickup) etc


Re: [HELP] DestroyPickup(pickup); - Sconosciuto - 25.11.2010

Fail....


Re: [HELP] DestroyPickup(pickup); - Larsey123IsMe - 25.11.2010

Quote:
Originally Posted by Sconosciuto
Посмотреть сообщение
Fail....
unnecessary post?


Re: [HELP] DestroyPickup(pickup); - Larsey123IsMe - 25.11.2010

I dont get it...


Something wrong with this?
pawn Код:
forward DestroyPickups();
pawn Код:
//Health~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    if( pickupid == HealthPickup){
        if(IsPlayerAdmin(playerid)==1){
      SetPlayerHealth(playerid, 100);
      SetTimer("DestroyPickups", 5000, false); //Pickus should come back after 5 secounds
      PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
      SendClientMessage(playerid,COLOR_ORANGERED,"You picked up Health!");
        }
        else return SendClientMessage(playerid,COLOR_RED,"This Health restore is just for ARMY!");
    }
pawn Код:
public DestroyPickups()
{
    DestroyPickup(HealthPickup);
    return 1;
}



Re: [HELP] DestroyPickup(pickup); - Larsey123IsMe - 25.11.2010

This code above have no effect... Whats erong -.-?


Re: [HELP] DestroyPickup(pickup); - Jeffry - 25.11.2010

Will you want the pickup to be created after 15 mins again, so you have to use:

pawn Код:
//Health~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if( pickupid == HealthPickup)
{
    if(IsPlayerAdmin(playerid)==1)
    {
        SetPlayerHealth(playerid, 100);
        DestroyPickup(HealthPickup); //The pickup (Health) should show after 15 min
        SetTimer("AddPickupAgain", 90000, false);
        PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
        SendClientMessage(playerid,COLOR_ORANGERED,"You picked up Health!");
    }
    else return SendClientMessage(playerid,COLOR_RED,"This Health restore is just for ARMY!");
}
and:
pawn Код:
forward AddPickupAgain();
public AddPickupAgain()
{
    //HealthPickup=CreatePickup ...
    return 1;
}
I hope you got it now.


Re: [HELP] DestroyPickup(pickup); - Larsey123IsMe - 25.11.2010

Quote:
Originally Posted by Jeffry
Посмотреть сообщение
Will you want the pickup to be created after 15 mins again, so you have to use:

pawn Код:
//Health~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if( pickupid == HealthPickup)
{
    if(IsPlayerAdmin(playerid)==1)
    {
        SetPlayerHealth(playerid, 100);
        DestroyPickup(HealthPickup); //The pickup (Health) should show after 15 min
        SetTimer("AddPickupAgain", 90000, false);
        PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
        SendClientMessage(playerid,COLOR_ORANGERED,"You picked up Health!");
    }
    else return SendClientMessage(playerid,COLOR_RED,"This Health restore is just for ARMY!");
}
and:
pawn Код:
forward AddPickupAgain();
public AddPickupAgain()
{
    //HealthPickup=CreatePickup ...
    return 1;
}
I hope you got it now.
<3 i got it <3

But the 90000 = Secounds? :S

pawn Код:
SetTimer("AddPickupAgain", 90000, false);



Re: [HELP] DestroyPickup(pickup); - Jeffry - 25.11.2010

You want 15 Minutes, which have 60 seconds each and timers use milliseconds, so we make x1000:

60 * 15 * 1000 = 900.000

Wops, forgot a '0'.

SetTimer("AddPickupAgain", 900000, false);

Now it should be correct.


Re: [HELP] DestroyPickup(pickup); - Jeffry - 25.11.2010

No problem.
Have fun.


Re: [HELP] DestroyPickup(pickup); - Sconosciuto - 26.11.2010

Quote:
Originally Posted by Larsey123IsMe
Посмотреть сообщение
unnecessary post?
I i've put a wrong code and i deleted it