SA-MP Forums Archive
Pickup that doesnt disappear? - 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)
+--- Thread: Pickup that doesnt disappear? (/showthread.php?tid=530315)



Pickup that doesnt disappear? - Blademaster680 - 06.08.2014

How can I make it so that when I enter a pickup it will send me the vehicle id the player is in. but the pickup must not disappear. it must always be there.
I am using createdynamicpickup.

I want it so when a player pickups the pickup it will display their vehicle id. but the pickup must not vanish. I have tried most pickup types but then the pickup doesn't even display. if the type is 0, it displays but cant view vehicle id.


Re: Pickup that doesnt disappear? - VenomMancer - 06.08.2014

Try to use type 2
https://sampwiki.blast.hk/wiki/PickupTypes


Re: Pickup that doesnt disappear? - Blademaster680 - 06.08.2014

Type 2 would make it disappear for 30 seconds though... . Type 1 works because it does what I want. but it floods the chat.

Код:
FuelPickup[fid] = CreateDynamicPickup(1244, 1, fInfo[fid][fPos][0], fInfo[fid][fPos][1], fInfo[fid][fPos][2], 0);
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
	for(new i = 1; i < MAX_FSTATIONS; i++)
	{
		if(pickupid == FuelPickup[i])
		{
			new id = GetPlayerVehicleID(playerid);
			new str[128];
			format(str, sizeof(str), "Vehicle ID: %d", id);
			SendClientMessage(playerid, -1, str);
		}
	}
	return 1;
}



Re: Pickup that doesnt disappear? - paulommu - 06.08.2014

Well, if any of these pickup types are suitable for you, then you should think about other possibilities.

Think about using the areas functions from Incognito's Streamer. They are very flexible; you can 'draw' 2D or 3D areas on the map, and check when a player enter or leaves it. Check this out:

pawn Код:
#define FUEL_AREA_RADIUS 5.0

new FuelArea = -1;

public OnGameModeInit()
    FuelArea = CreateDynamicCircle(10.0, 20.0, FUEL_AREA_RADIUS);

public OnPlayerEnterDynamicArea(playerid, areaid)
{
    if(areaid == FuelArea)
        SendClientMessage(playerid, -1, "You are at the fuel area!");

    return true;
}
Also, you can create a pickup without effect at the same point, just to identify the area.


Re: Pickup that doesnt disappear? - Stanford - 06.08.2014

About pickups, I think type 23 will do the job and use CreateDynamicPickup as it is more advanced and technically unlimited.


Re: Pickup that doesnt disappear? - Blademaster680 - 06.08.2014

paulommu's method worked . Thanks.

Stanford What does pickup 23 do?


Re: Pickup that doesnt disappear? - paulommu - 06.08.2014

Pickup type 23 triggers OnPlayerPickUpPickup and never disappears, but as far as I know, it only works with the player on-foot (and not in a vehicle). I actually use it to make entrance/exit locations.


Re: Pickup that doesnt disappear? - dirigent00 - 06.08.2014

On top of script:
Код:
InPickup[MAX_PLAYERS];
OnPlayerConnect:
Код:
InPickup[playerid] = 0;
Create pickup:
Код:
FuelPickup[fid] = CreateDynamicPickup(1244, 1, fInfo[fid][fPos][0], fInfo[fid][fPos][1], fInfo[fid][fPos][2], 0);
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
	for(new i = 1; i < MAX_FSTATIONS; i++)
	{
		if(pickupid == FuelPickup[i])
		{
			if(InPickup[playerid] == 0)
			{
				new id = GetPlayerVehicleID(playerid);
				new str[128];
				format(str, sizeof(str), "Vehicle ID: %d", id);
				SendClientMessage(playerid, -1, str);
				InPickup[playerid] = 1;
				SetTimerEx("PickupStop", 5000, false, "i", playerid);//Every 5 sec you can pickup the pickup, it will send after 5 sec the message
			}
		}
	}
	return 1;
}
Код:
forward PickupStop(playerid);
public PickupStop(playerid)
{
InPickup[playerid] = 0;
return 1;
}