[Tutorial] Create a pickup
#1

Hey guys for my first Tutorial, i'm going to show you how to create a pickup with pawno!
Fisrt open Pawno
Then create a new project by clicking on the blank page.
Under :
Code:
#include <a_samp>
Put :
Code:
new ls;
You should have this
Code:
#include <a_samp>

new ls;
Now Under
Code:
public OnGameModeInit()
, write or copy this :
Code:
ls = CreatePickup(model, type, Float:X, Float:Y, Float:Z, Virtualworld);
!!!! If you don't know what means "model, type, Float:X, Float:Y, Float:Z, Virtualworld", read this:

Code:
1) Model : The model of the pickup. 

2) Type : The pickup spawn type. 

3) Float:X : The X coordinate to create the pickup at. 

4) Float:Y : The Y coordinate to create the pickup at. 

5) Float:Z : The Z coordinate to create the pickup at. 

6) Virtualworld : The virtual world ID of the pickup. Use -1 to make the pickup show in all worlds.
-1 = Appears in every world.
Example :
Code:
ls = CreatePickup(1212, 2, 704.4722, -442.9513, 16.3359, -1);
You should have this :
Code:
public OnGameModeInit()
{
	ls = CreatePickup(1212, 2, 704.4722, -442.9513, 16.3359, -1);
	return 1;
}
Then go to
Code:
public OnPlayerPickUpPickup (playerid, pickupid)
And write this under :
Code:
if(pickupid == ls) GivePlayerMoney(playerid, 150000);
if(pickupid == ls) SetPlayerHealth(playerid, 100);
if(pickupid == ls) SetPlayerArmour(playerid, 100);
// That give you $150000, 100% Health and Armour!
// You can Repace the codes or add one by writing
Code:
if(pickupid == ls YourCode)
(with an space between if(pickupid == ls) and YourCode and Here your code

For who have bugs when compiling or for those who are lazy i put here the final code and i join the .pwn :
Code:
#include <a_samp>

new ls;
public OnGameModeInit()
{
	ls = CreatePickup(1212, 2, 704.4722, -442.9513, 16.3359, -1);
	return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
	if(pickupid == ls) GivePlayerMoney(playerid, 150000);
	if(pickupid == ls) SetPlayerHealth(playerid, 100);
	if(pickupid == ls) SetPlayerArmour(playerid, 100);
	return 1;
}
//It was a very very very very simple tutorial by 1Geek xD :P
Hoping to have helped more than one
================================================== ==========================================
> And for those who do not find the ids they are below <

Code:
Model IDs:

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
Code:
Pickup Types :

 0 The pickup does not display.
 1 Exists always. Disables pickup scripts such as horseshoes and oysters to allow for scripted actions ONLY.
 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.
Reply
#2

Useful! thanks bro
Reply
#3

Why not just:
pawn Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == ls)
    {
        GivePlayerMoney(playerid, 150000);
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 100);
    }
    return 1;
}
instead of checking if the pickupid is ls three times?
Reply
#4

Quote:
Originally Posted by Konstantinos
View Post
Why not just:
pawn Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == ls)
    {
        GivePlayerMoney(playerid, 150000);
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 100);
    }
    return 1;
}
instead of checking if the pickupid is ls three times?
Haha! It is on it's quicker and easier.
To try!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)