Q: Fishing System [Using Arrays]
#1

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/
Reply
#2

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.
Reply
#3

Fish Filterscript Please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)