[HowTo] How to add pickups with effects
#1

How To:
Ok I am going to make a tutorial on how to create pickups with effects.
Step 1:
Ok first we are going to add the pickup's name. At the top of your script add:
pawn Code:
new pickup1
Step 2:
Now, we are going to create the pickup. We are going to script under
pawn Code:
public OnGameModeInit()
{
     return 1;
}
So under there we will add this:
pawn Code:
public OnGameModeInit()
{
     pickup1 = CreatePickup(1242, 2, 1503.3359, 1432.3585, 10.1191, -1);
     //CreatePickup(model id, pickup spawn type, X coordinate, Y coordinate, Z coordinate, virtual world)
     //Pickup spawn type is the type you want it to spawn. There are 23 types. The basic one is 2. 2 is where if you pick it up it will respawn in some time. Find a list at https://sampwiki.blast.hk/wiki/PickupTypes
     return 1;
}
Step 3:
Now we are going to make the effects to where if you walk into the pickup something happens. We are going to work here
pawn Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}
Add this:
pawn Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    SetplayerHealth(playerid, 100); //effect number 1.
    SendClientMessage(playerid, 0x00000F, "You have be healed");   
    return 1;
   
}
//If you want more then one pickup do this
//if(pickupid == pickup1)//At the start remember when we added "new pickup1". Well this is saying if the pickupid or pickupname = pickup1(the pickup we created) then there will be these effects below:
//{
//    SetplayerHealth(playerid, 100); //effect number 1.
//    SendClientMessage(playerid, 0x00000F, "You have be healed"); 
//    return 1;
//}
//else
//the pickup id and all the th8ings we did up there
Step 4:
Now we are done. Wasn't that simple? Now go have some fun scripting!
Reply
#2

Very thanks....
Reply
#3

Simple, but nice TUT
Reply
#4

try this though instead of having // at every new sentence use this

pawn Code:
/*
You text here
*/
buy nice TuT
Reply
#5

Thanks guys for the comments, really appreciated.
Reply
#6

Thanks for the tut!
Reply
#7

Useful but maybe show more examples.
Reply
#8

I like it very much and gonna try now.....Bye
Reply
#9

Very good .. 10/10 .. it's simple but useful.. Only 2 problems "new pickup1" - "new pickup1;" and "SetplayerHealth" - "SetPlayerHealth"
Reply
#10

nice , keep it up
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)