pickup with timer problem
#1

I can't figure out what I did wrong with the timer but the pickup just keeps spawning every second after i set it to every 30 minutes...any help?

Код:
#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print("     SimeyDude's money Pickup       ");
	print("----------------------------------\n");
}

#endif
forward message(playerid);
new pickup;
public OnGameModeInit()
{
    pickup = CreatePickup(1550, 1,-2458.8059,517.3420,9.3583, -1);
	return 1;
}
Timer
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{	if(IsPlayerInRangeOfPoint(playerid, 3,-2458.8059,517.3420,9.3583))
	{
	GivePlayerMoney(playerid, 500000);
	SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+24);
	SetPlayerScore(playerid, GetPlayerScore(playerid)+3);
	SendClientMessage(playerid,0xFFFFFFAA, "You have just Robbed The San Andreas Federal MINT And Stole $500,000 - The cops are on their way!");
	SendClientMessageToAll(0x00FF00FF, " San Andreas Federal MINT in SF was Robbed. ");
 	DestroyPickup(pickup);
    SetTimer("message", 1800000, false);
	return 1;
	}
	return 0;
}
public message(playerid)
{
pickup = CreatePickup(1550, 1, -2458.8059,517.3420,9.3583, -1);
}
Reply
#2

First thing, you don't need IsPlayerInRangeOfPoint under OnPlayerPickupPickUp. Use
pawn Код:
if(pickupid == yourpickuphere)
// code here
Second, look at your CreatePickup code. Look at the second parameter. That is the type parameter, which in your case is 1. Pickup type 1 makes it so that if a player picks it up it still stays there. Change that parameter according to this.
Код:
 0 The pickup does not display.
 1 Not pickupable, exists all the time. (Suitable for completely scripted pickups using OnPlayerPickUpPickup)
 2 Pickupable, respawns after some time.
 3 Pickupable, respawns after death
 4 Disappears shortly after created (perhaps for weapon drops?)
 5 Disappears shortly after created (perhaps for weapon drops?)
 8 Pickupable, but has no effect. Disappears automatically.
 11 Blows up a few seconds after being created (bombs?)
 12 Blows up a few seconds after being created.
 13 Slowly decends to the ground.
 14 Pickupable, but only when in a vehicle.
 15 Pickupable, respawns after death
 19 Pickupable, but has no effect (information icons?)
 22 Pickupable, respawns after death.
 23 Pickupable, but doesn't disappear on pickup.
Reply
#3

I think I choose the right one ID(1) because a different one like ID(2) would only disappear for the person who picked it up...and read the description beside the ID 1 on that chart it suits my needs
Reply
#4

Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == pickup)
    {
		if(IsPlayerInRangeOfPoint(playerid, 3,-2458.8059,517.3420,9.3583))
		{
		GivePlayerMoney(playerid, 500000);
		SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+24);
		SetPlayerScore(playerid, GetPlayerScore(playerid)+3);
		SendClientMessage(playerid,0xFFFFFFAA, "You have just Robbed The San Andreas Federal MINT And Stole $500,000 - The cops are on their way!");
		SendClientMessageToAll(0x00FF00FF, " San Andreas Federal MINT in SF was Robbed. ");
 		DestroyPickup(pickup);
    	SetTimer("message", 1800000, false);
		}
		return 1;
	}
	return 0;
}
Reply
#5

@GtasaPoliceModz that didn't fix it its still spawning back a second after i pick it up...
Reply
#6

Код:
public OnGameModeInit()
{
    pickup = CreatePickup(1550, 2,-2458.8059,517.3420,9.3583, -1);
	return 1;
}
Reply
#7

That didn't do anything diffrent, still spawns back after a second
Reply
#8

Код:
 public OnPlayerPickUpPickup(playerid, pickupid)
{
	if(IsPlayerInRangeOfPoint(playerid, 3,-2458.8059,517.3420,9.3583))
	{
	GivePlayerMoney(playerid, 500000);
	SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+24);
	SetPlayerScore(playerid, GetPlayerScore(playerid)+3);
    SetTimer("message", 1800000, false);
	return 1;
	}
	return 0;
}
public message(playerid)
{
	SendClientMessage(playerid,0xFFFFFFAA, "You have just Robbed The San Andreas Federal MINT And Stole $500,000 - The cops are on their way!");
	SendClientMessageToAll(0x00FF00FF, " San Andreas Federal MINT in SF was Robbed. ");
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)