SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 23/03/2012, 06:05 AM   #1
Reklez
Gangsta
 
Reklez's Avatar
 
Join Date: Mar 2012
Location: Philippines
Posts: 563
Reputation: 64
Default Creating a Simple Pickup

Creating a Simple Pickup

In this tutorial you will learn how to use pickup's for giving cash/giving weapon

Tutorial:

we will gonna use this function to create a pickup...

Code:
CreatePickup(model, type, Float:X, Float:Y, Float:Z, virtualworld = 0);

How to create a pickup?:

Simple just add

Code:
new nameitwhatever; //add this at the top of script after #include <a_samp> or other #include <blahblahblah>

you will get this warning

Code:
warning 203: symbol is never used: "nameitwhatever"
this is because nameitwhatever is never used. to use it just do

Code:
nameitwhatever = CreatePickup(model, type, Float:X, Float:Y, Float:Z, virtualworld = 0);

place it OnGameModeInit - if you gonna make a Gamemode
and place it OnFilterscriptInit - if you gonna make a filterscript

Model:

Code:
1210 - Briefcase
1212 - Money
1239 - Information
1240 - Heart
1241 - Adrenaline pill
1242 - Armor
1247 - Bribe
1248 - Gta 3 logo
1252 - Grey bomb
1253 - Photo Op
1254 - rampage (single skull)
1313 - two player rampage (skulls)
1272 - blue house
1273 - green house
1274 - dollar
1275 - blue t-shirt
1276 - tiki 
1277 - save disk
1279 - drug bundle
1313 - 2 skulls icon
1314 - 2 player
1316 - Corona (textures missing)
1317 - Checkpoint (textures missing)
1318 - White arrow (pointing down)
1559 - Interior enter/exit diamond
1582 - Pizza Box
2894 - Madd Dogg's rhyme book
Types:

Code:
 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.
How do i get Float:X/Y/Z coordinates?

1.) Go In-Game (SAMP not Single Player)
2.) Go to Position where you want to place your pickup
3.) type /save [nameitwhateveryouwant]
4.) Go to My Doucments/GTA San Andreas Directory/SAMP/savedposition.txt
5.) You will see something like this

Code:
AddPlayerClass(skinid, x, y, z, angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo); //nameitwhateveryouwant

copy the x, y, z then paste it here

Code:
CreatePickup(model, type, Float:X, Float:Y, Float:Z, virtualworld = 0);

now back to the tutorial place the model/type/x/y/z/virtualworld to whatever you want.
now compile it you will get this warning

Code:
warning 204: symbol is assigned a value that is never used: "nameitwhatever"
we use it but still pawno reads it as it never use in scripting code, now we will use it OnPlayerPickUpPickup

search for

Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

now add this

Code:
if(pickupid == nameitwhatever) //when player pickups the nameitwhatever
{
      //codes - what you want to do to player when player pickups the pickup
}

How to give player cash when player pickups the pickup?

Just simply do

Code:
if(pickupid == nameitwhatever) 
{
       GivePlayerMoney(playerid, 1000); //When player pickups the pickup he will get $1,000
}

How to give player weapon when player pickups the pickup?

Just do

Code:
if(pickupid == nameitwhatever) 
{
       GivePlayerWeapon(playerid, 22, 1000); //When player pickps the pickup he will get 9mm with ammo 1000
}

Example:

Code:
new PickupTest; //at the top of scripter

PickupTest = CreatePickup(1239, 23, 2044.2612,-1487.2828,10.8281, -1); //will create the pickup at the front of CJ's House with in virtual world all (-1 means all of Virtual World), the pickup model is 'i' info icon, and the type is it doesn't disappear when pickup by player

public OnPlayerPickUpPickup(playerid, pickupid)
{
	if(pickupid == PickupTest) { //if player pickups the PickupTest
                 SetPlayerPos(playerid, 1723.0146,-1878.4855,13.5646); //this will set player's position to Unity Station
                 SetPlayerFacingAngle(playerid, 359.2945);
		 return 1;
	}
	return 1;
}

The End:

i hope you learn something to me about Pickups.
__________________

Asking a reputation for Server Advertisement? You kidding me, You are totally n00b!

Last edited by Reklez; 23/03/2012 at 06:41 AM.
Reklez is offline   Reply With Quote
Old 23/03/2012, 06:43 AM   #2
GAMER_PS2
Huge Clucker
 
GAMER_PS2's Avatar
 
Join Date: Aug 2011
Posts: 345
Reputation: 19
Default Re: Creating a Simple Pickup

Quote:
new PickupTest; //at the top of scripter

public OnGameModeInIt()
{
PickupTest = CreatePickup(1239, 23, 2044.2612,-1487.2828,10.8281, -1); //will create the pickup at the front of CJ's House with in virtual world all (-1 means all of Virtual World), the pickup model is 'i' info icon, and the type is it doesn't disappear when pickup by player
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == PickupTest) { //if player pickups the PickupTest
SetPlayerPos(playerid, 1723.0146,-1878.4855,13.5646); //this will set player's position to Unity Station
SetPlayerFacingAngle(playerid, 359.2945);
return 1;
}
return 1;
}
But A Nice Tutorial .
__________________
Ronnie Ronnie Ronnie Ronnie
Not GAMER_PS2
GAMER_PS2 is offline   Reply With Quote
Old 10/02/2013, 03:37 PM   #3
Phil_Cutcliffe
Huge Clucker
 
Phil_Cutcliffe's Avatar
 
Join Date: Dec 2011
Location: United Kingdom, London
Posts: 338
Reputation: 7
Default Re: Creating a Simple Pickup

Nice tutorial but do you know how to make it possible when a player is in a vehicle he can still get the pickup without command?? I got mine working on foot but not in vehicle..
Phil_Cutcliffe is offline   Reply With Quote
Old 07/01/2014, 05:26 PM   #4
LukHacker
Little Clucker
 
Join Date: Jan 2014
Posts: 1
Reputation: 0
Default Re: Creating a Simple Pickup

ah download ?
LukHacker is offline   Reply With Quote
Old 07/01/2014, 08:53 PM   #5
Hansrutger
Gangsta
 
Hansrutger's Avatar
 
Join Date: May 2011
Location: Sweden
Posts: 863
Reputation: 121
Default Re: Creating a Simple Pickup

Quote:
Originally Posted by LukHacker View Post
ah download ?
http://forum.sa-mp.com/forumdisplay.php?f=17
__________________



Current progression on roleplay gamemode:
Week 1 (22/04-30/04): 10524 loc
...
Week 12 (09/07-16/07): 66599 loc​
Hansrutger is online now   Reply With Quote
Old 15/02/2014, 03:19 PM   #6
MarkenFrank1
Little Clucker
 
Join Date: Sep 2013
Location: The Netherlands
Posts: 29
Reputation: 0
Default Re: Creating a Simple Pickup

Thanks, it works
MarkenFrank1 is offline   Reply With Quote
Old 18/02/2014, 07:18 PM   #7
Omar55555
Huge Clucker
 
Omar55555's Avatar
 
Join Date: Jun 2013
Location: Area 69
Posts: 264
Reputation: 17
Default Re: Creating a Simple Pickup

sorry for bumbing but i did a big briefcase system and when i did it all in filterscript it didn't work,

now i re-typed all the things in my gamemode and it works,

is the pickups can't be added in filterscript or i'm doing something wrong ?
__________________
Omar55555 is offline   Reply With Quote
Old 14/07/2017, 07:37 PM   #8
2xRichard
Little Clucker
 
2xRichard's Avatar
 
Join Date: Jul 2017
Posts: 3
Reputation: 0
Default Re: Creating a Simple Pickup

Omar55555 You can Add it to FilterScript , Go to Pwno > Ctrl+N > Ctrl+A > Deleted All Line's > Select it lins > Ctrl+C > go to pwno > Ctrl+V and prees Ctrl+S , The End

//
#include <a_samp>
#if defined FILTERSCRIPT
#else
#endif
//-------------------------------- Pickups -------------------------------------

new Pickup11; //Hospital 1 LS big ammu

//------------------------------------------------------------------------------
public OnGameModeInit()
{
Pickup11 = CreatePickup(1240, 2,1173.22900,-1323.72876,15.20000); // Created Pickup to Hospital Ls
return 1;
}

//------------------------------------------------------------------------------
public OnPlayerPickUpPickup(playerid, pickupid)
{
// Hospitals
if(pickupid == Pickup11)
{
SetPlayerHealth(playerid, 100);
}
return 1;
}

------
Guys i need help i cant created pickup and if player join to pickup Teleport player to Big ammu ?
Pls get me cods tnx <3

Last edited by 2xRichard; 14/07/2017 at 09:44 PM.
2xRichard is offline   Reply With Quote
Old 15/07/2017, 08:53 PM   #9
JasonRiggs
Huge Clucker
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 318
Reputation: 6
Default Re: Creating a Simple Pickup

Nice one to help newbies eh..
__________________

TS3 : FR3.ts-3.cx:15487
Server IP: 185.12.178.71:7799
Website: nyakos-rp.weebly.com
JasonRiggs is offline   Reply With Quote
Old 15/07/2017, 08:56 PM   #10
HoussemGaming
Big Clucker
 
HoussemGaming's Avatar
 
Join Date: Jun 2017
Location: France
Posts: 143
Reputation: 6
Default Re: Creating a Simple Pickup

Bumping old years thread
__________________
My works
Filterscripts
HoussemGaming is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a weapon pickup? Angelo94 Scripting Help 11 07/03/2014 10:52 PM
Creating a Pickup Jordiee Scripting Help 4 14/11/2011 12:41 PM
[Help] ZCMD Dynamic Pickup Creating Dudits Help Archive 10 15/07/2010 03:15 AM
Creating a pickup in an interior sean5874 Help Archive 2 22/05/2010 01:27 PM
Creating a Pickup... Abernethy Help Archive 4 27/06/2009 12:06 AM


All times are GMT. The time now is 11:05 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.