SA-MP Forums Archive
Enum variable which isn't a playerid (+REP) - 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: Enum variable which isn't a playerid (+REP) (/showthread.php?tid=582948)



Enum variable which isn't a playerid (+REP) - Lirbo - 24.07.2015

PHP код:
enum FactionData
{
    
Name,
    
Materials,
    
Guns,

so how can i get the faction? my factions exist in a folder and they're named by their name, for example: Ballas.ini etc, and I can't do this: new FDB[MAX_FACTIONS][FactionData] since MAX_FACTIONS isn't exist.
sry for my fucking shitty english i wrote it in a minute.


Re: Enum variable which isn't a playerid (+REP) - xVIP3Rx - 24.07.2015

You could count the files in the folder (I didn't figure out how but I think it's possible) and set MAX_FUNCTION to it, or make a variable and increase it everytime you load a file, which I usually do, or you could do the easiest way if they don't change and add a random number that no one can exceed it, for example 100, but it'll take unnecessary memory.


Re: Enum variable which isn't a playerid (+REP) - Lirbo - 24.07.2015

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
You could count the files in the folder (I didn't figure out how but I think it's possible) and set MAX_FUNCTION to it, or make a variable and increase it everytime you load a file, which I usually do, or you could do the easiest way if they don't change and add a random number that no one can exceed it, for example 100, but it'll take unnecessary memory.
I didnt really get it can u show me an example pls?


Re: Enum variable which isn't a playerid (+REP) - xVIP3Rx - 24.07.2015

I will, show me the "create faction" function or command


Re: Enum variable which isn't a playerid (+REP) - Lirbo - 24.07.2015

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
I will, show me the "create faction" function or command
There's no create faction cmd, I make it manually.


Re: Enum variable which isn't a playerid (+REP) - xVIP3Rx - 24.07.2015

How ?,

And if you make in manually just increase the MAX_FUNCTIONS manually too, like this
pawn Код:
#define MAX_FUNCTIONS 5
and every time you add one increase it.