SA-MP Forums Archive
pickup not working in vehicle - 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 not working in vehicle (/showthread.php?tid=414783)



pickup not working in vehicle - Phil_Cutcliffe - 10.02.2013

Here's my code.. What's missing for my mats pickup?

Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
	if(pickupid == mats) {
    if(PlayerInfo[playerid][pSupplies] >= 250)
	{
 		SendClientMessage(playerid, COLOR_BLUE, "You got 100 mats for your 250 supplies");
   		PlayerInfo[playerid][pMats] += 100;
   		PlayerInfo[playerid][pSupplies] -= 250;
	}
	}
    if(pickupid == emtchange) {
    if(PlayerInfo[playerid][pFaction] != 255 && FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 4)
	{
	    TogglePlayerControllable(playerid,false);
		ShowMenuForPlayer(emtclothes,playerid);
	}
	}
    if(pickupid == pdchange) {
    if(PlayerInfo[playerid][pFaction] != 255 && FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 1)
	{
    TogglePlayerControllable(playerid,false);
	ShowMenuForPlayer(pdclothes,playerid);
	}
	}
    if(pickupid == fbichange) {
    if(PlayerInfo[playerid][pFaction] != 255 && FactionInfo[PlayerInfo[playerid][pFaction]][fType] == 2)
	{
    TogglePlayerControllable(playerid,false);
	ShowMenuForPlayer(fbiclothes,playerid);
	}
	}
	if(pickupid == dtp) {
    TogglePlayerControllable(playerid,false);
	ShowMenuForPlayer(DrivingM,playerid);
	}
	if(pickupid == spickup) {
    TogglePlayerControllable(playerid,false);
	ShowMenuForPlayer(FStyles,playerid);
	}
	if(pickupid == ammu) {
    TogglePlayerControllable(playerid,false);
	ShowMenuForPlayer(ammumenu,playerid);
	}
	if(pickupid == wlic) {
    GameTextForPlayer(playerid, "~>~~w~/buyweaplic~<~", 3000, 3);
	}
	if(pickupid == flic) {
    GameTextForPlayer(playerid, "~>~~w~/buyfishlic~<~", 3000, 3);
	}
	if(pickupid == fsell) {
    GameTextForPlayer(playerid, "~>~~w~/sellfish~<~", 3000, 3);
	}
	if(pickupid == drugs) {
	ShowPlayerDialog(playerid,7,DIALOG_STYLE_LIST,"Drugs","Weed Seeds\nCocaine Seeds\nPsilocybin mushrooms Seeds\nLSD(Acid)","Purchase","Cancel");
	}
	if(pickupid == supplies) {
    GameTextForPlayer(playerid, "~>~~w~/buysupplies~<~", 3000, 3);
	}
}
Works fine when I am on foot but when in a vehicle this does not work?


Re: pickup not working in vehicle - Phil_Cutcliffe - 10.02.2013

-bumped as not had a reply in hours


Re: pickup not working in vehicle - batonsa - 10.02.2013

I think most pickups are not usable from inside vehicles.

I suggest you use IsPlayerinRangeOfPoint for ppl that are driving while entering the pickup.


Re: pickup not working in vehicle - Phil_Cutcliffe - 10.02.2013

Quote:
Originally Posted by batonsa
Посмотреть сообщение
I think most pickups are not usable from inside vehicles.

I suggest you use IsPlayerinRangeOfPoint for ppl that are driving while entering the pickup.
An example please if you would? =]

EDIT: I know how to use this, just not with what I want to do..


Re: pickup not working in vehicle - MP2 - 10.02.2013

https://sampwiki.blast.hk/wiki/PickupTypes

14 Pickupable, but only when in a vehicle.

If you want the pickup to be pickupable on-foot AND in-vehicle, you should create both types (on-foot and in-vehicle) in the same place and use blankmodel (model 19300) for the vehicle pickup one.


Re: pickup not working in vehicle - Phil_Cutcliffe - 10.02.2013

Quote:
Originally Posted by MP2
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/PickupTypes

14 Pickupable, but only when in a vehicle.

If you want the pickup to be pickupable on-foot AND in-vehicle, you should create both types (on-foot and in-vehicle) in the same place and use blankmodel (model 19300) for the vehicle pickup one.
Brilliant! I understand perfectly! =]


Re: pickup not working in vehicle - Babul - 11.02.2013

keep in mind that sometimes a pickup will not get picked up, when a player is too fast in his vehicle. speeds <100km/h should be fine. if you intend to use pickups on roads (races), then you maybe need to create multiple ones.


Re: pickup not working in vehicle - MP2 - 11.02.2013

Quote:
Originally Posted by Babul
Посмотреть сообщение
keep in mind that sometimes a pickup will not get picked up, when a player is too fast in his vehicle. speeds <100km/h should be fine. if you intend to use pickups on roads (races), then you maybe need to create multiple ones.
Wow, never knew that, thanks for that. I had to test it just to see it for myself:

[ame]http://www.youtube.com/watch?v=BoYMuf7q8v8[/ame]

:P

Shame really. Makes my plans for OPU/timer-less spike strips kinda fail :/ What's the best way to fix it?