Weapon 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: Weapon Pickup. (
/showthread.php?tid=278223)
Weapon Pickup. -
Lower - 21.08.2011
So i'm trying to create a weapon pickup, in this case a 'tec9' when you pick it up it'll give you the tec9, i've been trying to find something to help me, but all threads around from around 2008.
Anyone can show me how please?
Re: Weapon Pickup. -
Darnell - 21.08.2011
CreatePickup.
&
OnPlayerPickUpPickUp
Re: Weapon Pickup. -
Lower - 21.08.2011
Quote:
Originally Posted by Darnell
|
i've tried this, but i don't know where to add the line of code wher eit gives the player the weapon and all
Re: Weapon Pickup. -
Wesley221 - 21.08.2011
pawn Code:
new Pickupname; // Global variable for your pickup NOTE: Outside any callback
Pickupname = CreatePickup(model, type, Float:X, Float:Y, Float:Z, Virtualworld); // Stores the createpickup in the variable NOTE: Put this in ongamemodeinit
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == Pickupname) // Checks if you picked up the pickup
{
// if you pickup the variable "Pickupname"
}
return 1;
}
https://sampwiki.blast.hk/wiki/OnPlayerPickUpPickup
https://sampwiki.blast.hk/wiki/CreatePickup
https://sampwiki.blast.hk/wiki/PickupTypes
https://sampwiki.blast.hk/wiki/GivePlayerWeapon
If you need any help, just post again
Re: Weapon Pickup. -
Darnell - 21.08.2011
Here you go :
pawn Code:
new tec9; // Definig the pickup.
tec9 = CreatePickup(372, 2, 1503.3359, 1432.3585, 10.1191, -1) // The pickup itself.
public OnPlayerPickUpPickup(playerid, pickupid)//When player picks a pickup.
{
if(pickupid == tec9) GivePlayerWeapon(playerid,32,200); // Giving the player the teec9 when he picks the tec-9 with 200 ammo.
return 1;
}
EDIT:
Too late :\.
Re: Weapon Pickup. -
Lower - 21.08.2011
Thanks!
Re: Weapon Pickup. -
Darnell - 21.08.2011
No problem.