Pickup Help - 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: Pickup Help (
/showthread.php?tid=89579)
Pickup Help -
burgershot - 02.08.2009
Okay so my server has ALOT of health pickups. instead of doing
if(pickupid==health1)
if(pickupid==health2)
if(pickupid==health3)
etc.
is there a faster way to do it? Something like healthpickups={createpickup();createpickup();}
if(pickupid==healthpickups)
thanks in advance
Re: Pickup Help -
Jefff - 02.08.2009
Simply way
Код:
new HealthPick[YOUR_NUMBER_OF_PICKUPS];
HealthPick[0] = CreatePickup....
HealthPick[1] = CreatePickup....
etc
for(new i; i < YOUR_NUMBER_OF_PICKUPS; i++) {
if(pickupid == HealthPick[i]) {
//something
}
}
Re: Pickup Help -
anonymoushacker - 02.08.2009
your lazy dude... if you can't do that little bit just to make a pickup, u r not going to make it far in scripting, u need to do all the work thats required man, and stop being lazy.
Re: Pickup Help -
Yuryfury - 02.08.2009
Well I doubt that he is lazy, he just is looking for a more efficient way to do it
Re: Pickup Help -
Jefff - 02.08.2009
Or very fast xD
Код:
#define MAX_HEALTH YOUR_NUMBER_OF_PICKUPS
new HealthPick[MAX_HEALTH];
new Float:PickupCoords[MAX_HEALTH][3] = {
{X,Y,Z},
{},
{},
{},
{},
{}
};
init
Код:
for(new i; i < MAX_HEALTH; i++) {
HealthPick[i] = CreatePickup(ID, Type, PickupCoords[i][0], PickupCoords[i][1], PickupCoords[i][2]);
}
Re: Pickup Help -
anonymoushacker - 02.08.2009
lol, i aint trying to be mean, but not all the commands are going to be made easy u know..
Re: Pickup Help -
Mr_Finnigan - 03.08.2009
Quote:
Originally Posted by anonymoushacker
lol, i aint trying to be mean, but not all the commands are going to be made easy u know..
|
I know from experience when i do
Код:
if(pickupid==health1)
if(pickupid==health2)
if(pickupid==health3)
etc.
Then ask for help the first reply i get is for some scripting professional asking me why i wasted all that time and did not use
Код:
#define MAX_HEALTH YOUR_NUMBER_OF_PICKUPS
new HealthPick[MAX_HEALTH];
new Float:PickupCoords[MAX_HEALTH][3] = {
{X,Y,Z},
{},
{},
{},
{},
{}
};