SA-MP Forums Archive
Q: Fishing System [Using Arrays] - 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)
+--- Thread: Q: Fishing System [Using Arrays] (/showthread.php?tid=334167)



Q: Fishing System [Using Arrays] - Ezay - 14.04.2012

Hey Lads,


Um, I'm Wondering How I'd Go About Making a Fishing System Using Arrays.
Basically, I'm Going to be Using Different Bait to Catch Different Fish, (Witch i Think is Possible)

Now,
I Was Going to Use Cases, But It's Just Looks a Mess, But Then Again, Someone can Tell me Use Arrays or Cases.

Basically, i Want Something Like
Lets Say We Create 2 Seperate Arrays?

Код:
enum fPrawnsBait //Bait Name (These Fish Can Only Be Caught Using This Bait)
{
	{"Yellowtail"}, //Fish Names
	{"Mungrove"}, //Fish Names
};
Код:
enum fYabbiesBait //Bait Name (These Fish Can Only Be Caught Using This Bait)
{
	{"Blackfin"}, //Fish Names
	{"MurrayCOD"}, //Fish Names
};
Now I Think Thats Right Their, But Correct me if I'm Wrong However / Point me to the Right Direction.
But However, How Would i Make It So If The Fella has Yabbies as his Bait, he Can only Catch the Fish in That Array?
Then Using a String to Show the Name of the Fish, e.g You've Caught a %s

Код:
if(FishingBaitYabbies[playerid] => 1)
{
//Only Catch Fish That Can Be Caught With Yabbies Using Our Array? I Dunno if This is Correct, Done in My Head.
}
Cheers, Sorry its Story Length xD
But to Whoever can Help, Thanks Alot.


Ezay
\o/


Re: Q: Fishing System [Using Arrays] - [HiC]TheKiller - 14.04.2012

Take a look at https://sampforum.blast.hk/showthread.php?tid=318212

The way you would do this is like:
pawn Код:
new fishies[][]
{
    "Fish One",
    "Fish Two",
    "Fish Three"
    //.......
};
Then you can easily just chose a random fish name from this array by doing the following:
pawn Код:
new string[100];
format(string, sizeof(string), "You have caught a %s", fishies[random(sizeof(fishies))]);
If you are looking to put more information about the fish, look into 3 dimensional arrays or 2 dimensional arrays with enums.


Re : Q: Fishing System [Using Arrays] - Islam_Gerland_99 - 09.07.2012

Fish Filterscript Please