SA-MP Forums Archive
[HowTo] How to add pickups with effects - 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: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [HowTo] How to add pickups with effects (/showthread.php?tid=159668)



[HowTo] How to add pickups with effects - ToPhrESH - 14.07.2010

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!


Re: [HowTo] How to add pickups with effects - Thebest96 - 15.07.2010

Very thanks....


Re: [HowTo] How to add pickups with effects - hab2ever - 15.07.2010

Simple, but nice TUT


Re: [HowTo] How to add pickups with effects - willsuckformoney - 15.07.2010

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

pawn Code:
/*
You text here
*/
buy nice TuT


Re: [HowTo] How to add pickups with effects - ToPhrESH - 16.07.2010

Thanks guys for the comments, really appreciated.


Re: [HowTo] How to add pickups with effects - Min - 14.08.2010

Thanks for the tut!


Re: [HowTo] How to add pickups with effects - Retardedwolf - 16.08.2010

Useful but maybe show more examples.


Re: [HowTo] How to add pickups with effects - MBX97 - 17.08.2010

I like it very much and gonna try now.....Bye


Re: [HowTo] How to add pickups with effects - MoonCalF - 04.08.2012

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


Re: [HowTo] How to add pickups with effects - Devilxz97 - 04.08.2012

nice , keep it up