Assistance with my system
#7

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Check if the player's is admin inside the if statement about faction >= 0

pawn Код:
if (pData[playerid][pFaction] >= 0)
{
    format(str, sizeof(str), "%sList %s's Members\n", str, fData[pData[playerid][pFaction]][fName]);
    if (pData[playerid][pFactionRank] >= fData[pData[playerid][pFaction]][fManageRank])
    {
        format(str, sizeof(str), "%sManage %s's Members\n", str, fData[pData[playerid][pFaction]][fName]);
    }

    if (pData[playerid][pAdmin] > 1)
    {
        format(str, sizeof(str), "%sCreate Faction\nEdit Faction", str, fData[pData[playerid][pFaction]][fName]);
    }
}
That isn't quite needed because an admin should be able to create a faction, even if he isn't in one.
Everything within the dialog functions well, the only thing that fucks me up is the enum, let me show you.

Up top, I have this

Код:
#define MAX_FACTIONS 		(20)
Код:
new fData[MAX_FACTIONS][factions];
Код:
forward OnFactionLoad(); public OnFactionLoad()
{
	new rows, fields, count = 0;
	cache_get_data(rows, fields, mysql);
	if(rows)
	{
		while(count < rows)
		{
			fData[count][fID] = cache_get_field_content_int(count, "fID");
			cache_get_field_content(count, "fName", fData[count][fName], mysql, 30);
			and so on, all data gets loaded
			count++;
		}
		printf("%i factions loaded.", count);
	}
	else printf("No factions found.");
	factioncount = count;
}
What my problem is, it loads all data in the enum and starts at 0, so lets say the 1st row = fData[0][fID]
What my check does is
Код:
fData[pData[playerid][pFaction][fID]
which is basically the same as
Код:
fData[0][fID]
which results in
Код:
1
which is the first row here

And my thing is that if a player isn't in a faction, the pFaction of that playerid is 0
How would I go and re-write/fix this?
Reply


Messages In This Thread
Assistance with my system - by JaydenJason - 05.08.2016, 13:09
Re: Assistance with my system - by Stinged - 05.08.2016, 13:20
Re: Assistance with my system - by JaydenJason - 05.08.2016, 13:28
Re: Assistance with my system - by kanerandyfirst - 05.08.2016, 13:35
Re: Assistance with my system - by Stinged - 05.08.2016, 13:37
Re: Assistance with my system - by Konstantinos - 05.08.2016, 13:37
Re: Assistance with my system - by JaydenJason - 05.08.2016, 13:54
Re: Assistance with my system - by Stinged - 05.08.2016, 14:03
Re: Assistance with my system - by JaydenJason - 05.08.2016, 14:06
Re: Assistance with my system - by Stinged - 05.08.2016, 14:09

Forum Jump:


Users browsing this thread: 1 Guest(s)