SA-MP Forums Archive
[SOLVED]Help with OnPlayerPickupPickup - 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: [SOLVED]Help with OnPlayerPickupPickup (/showthread.php?tid=92502)



[SOLVED]Help with OnPlayerPickupPickup - Hiitch - 20.08.2009

Hi, I am having a problem with this Pickup stuff.

I have the pickups clearly added, but my problem is this, When I pickup a pickup, it always Splashes "You get 50k Dollars" instead of something else. For example, if the player picks up the armour pickup, he Must get the Message : "You got some armour, go own some noobs" But instead he gets the Message "You got 50k dollars!" and receives the armour +50k dollars, which shouldn't happen.

This is the code

Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
	if (pickup == pickupSaveDisk)
	{
	  GivePlayerMoney(playerid, 50000);
		GameTextForPlayer(playerid, "~g~You got 50k Dollars !", 3500, 0);
		return 1;
	}
	else if (pickup == pickupDollar)
	{
	  GivePlayerMoney(playerid, 100000);
	  GameTextForPlayer(playerid, "~g~You got 100k Dollars !", 3500, 0);
	  return 1;
	}
	else if (pickup == pickupArmour)
	{
		SetPlayerArmour(playerid, 100.0);
		GameTextForPlayer(playerid, "~b~~h~~h~You got armour ! Go own some noobs !", 3500, 0);
		return 1;
	}
	else if (pickup == pickupHealth)
	{
		SetPlayerHealth(playerid, 100.0);
		GameTextForPlayer(playerid, "~r~~h~You have been healed !", 3500, 0);
		return 1;
	}
	return 1;
}



Re: Help with OnPlayerPickupPickup - Mr_Finnigan - 20.08.2009

Can you show how you added the pickup itself?


Re: Help with OnPlayerPickupPickup - Hiitch - 20.08.2009

Uhh, sure. I followed the tutorial on SA:MP wiki for the pickups.

Код:
AddStaticPickup(1277, 2, -2197.9531,2322.2080,4.9844);
	AddStaticPickup(1274, 2, -2257.5752,2275.1821,4.9844);
	AddStaticPickup(1242, 2, -2292.2000,2229.9719,4.9822);
	AddStaticPickup(1240, 2, -2295.0957,2230.3643,4.9822);
And that is under OnGameModeInit(); Is that what you mean?

Otherwise I have these

Код:
new pickup;
new pickupSaveDisk;
new pickupDollar;
new pickupArmour;
new pickupHealth;



Re: Help with OnPlayerPickupPickup - Khelif - 20.08.2009

you have to define each pickup like this
pawn Код:
pickupSaveDisk = AddStaticPickup(1277, 2, -2197.9531,2322.2080,4.9844);
  pickupDollar = AddStaticPickup(1274, 2, -2257.5752,2275.1821,4.9844);



Re: Help with OnPlayerPickupPickup - kaisersouse - 20.08.2009

pickup id's in 02x are buggy. This is a known issue.


Re: Help with OnPlayerPickupPickup - Hiitch - 20.08.2009

Quote:
Originally Posted by ĸнelιғaтι
you have to define each pickup like this
pawn Код:
pickupSaveDisk = AddStaticPickup(1277, 2, -2197.9531,2322.2080,4.9844);
  pickupDollar = AddStaticPickup(1274, 2, -2257.5752,2275.1821,4.9844);
Where would I go about adding this?
Quote:
Originally Posted by kaisersouse
pickup id's in 02x are buggy. This is a known issue.
Hmm, I never knew that, but I hope maybe in 0.3 there will be a few fixes towards this issue


Re: Help with OnPlayerPickupPickup - Sergei - 20.08.2009

Use AddStaticPickup doesn't even return its ID...


Quote:

# AddStaticPickup - Doesn't return an id
# CreatePickup - Pickup ids are often different for different players. I presume it is a problem with keeping track of them and assigning ids for players. This affects OnPlayerPickUpPickup and DestroyPickup as they will be used with different pickups for players.

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


Re: Help with OnPlayerPickupPickup - Mr_Finnigan - 20.08.2009

Quote:
Originally Posted by Hiitch[WS
- WestSide Servers ]
Quote:
Originally Posted by ĸнelιғaтι
you have to define each pickup like this
pawn Код:
pickupSaveDisk = AddStaticPickup(1277, 2, -2197.9531,2322.2080,4.9844);
  pickupDollar = AddStaticPickup(1274, 2, -2257.5752,2275.1821,4.9844);
Where would I go about adding this?
Quote:
Originally Posted by kaisersouse
pickup id's in 02x are buggy. This is a known issue.
this goes under OnGameModeInit

pawn Код:
pickupSaveDisk = AddStaticPickup(1277, 2, -2197.9531,2322.2080,4.9844);
  pickupDollar = AddStaticPickup(1274, 2, -2257.5752,2275.1821,4.9844);

Hmm, I never knew that, but I hope maybe in 0.3 there will be a few fixes towards this issue



Re: Help with OnPlayerPickupPickup - timmehhh - 20.08.2009

Код:
if (pickup == pickupSaveDisk)
	{
Isnt that supposed to be

Код:
 if (pickupid == pickupSaveDisk)
	{



Re: Help with OnPlayerPickupPickup - Hiitch - 20.08.2009

Quote:
Originally Posted by timmehhh
Код:
if (pickup == pickupSaveDisk)
	{
Isnt that supposed to be

Код:
 if (pickupid == pickupSaveDisk)
	{
I tried using (pickupid == pickupSaveDisk)

But it didnt work, now what happens is, if a Player walks into the Pickup, only 1 of them shows the splash, and the rest of them dont... Is there any way to fix this?