SA-MP Forums Archive
Just a simple question - 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: Just a simple question (/showthread.php?tid=620124)



Just a simple question - StrikerZ - 26.10.2016

I'm making a faction system using finfo as the enum and FactionInfo as the info variables. So everything is setup but how do i make slots for factions?


Re: Just a simple question - ThatFag - 26.10.2016

What do you mean by slots, like making an amount of max factions or ?


Re: Just a simple question - StrikerZ - 26.10.2016

Like if we do /createfaction a slot gets used up by that faction which is created. Yeah in amount of max factions


Re: Just a simple question - ThatFag - 26.10.2016

can u show Enum of factioninfo pls.


Re: Just a simple question - StrikerZ - 26.10.2016

PHP код:
enum fInfo
{
    
FacName[50],
    
FacOwner[20],
    
FacLevels,
    
FacRanks,
    
FacSlots[10//im not sure about this variable
}; 



Re: Just a simple question - ThatFag - 26.10.2016

Код:
#define MAX_FACTIONS      10 // at defines

stock GetUnusedFaction()
{
	new hf[64];
	for(new h=0; h<=MAX_FACTIONS; h++)
	{
	    format(hf,sizeof(hf),"The file you saving factions",h);
	    if(dini_Exists(hf)) continue;
	    return h;
	}
	return -1;
}
and also remove FacSlots from finfo.

The codes that are up here will get the unused faction slot and also reads if the max_factions has been reached.


Re: Just a simple question - StrikerZ - 27.10.2016

I didn't understand :/ i need some explanations and some simple steps pls


Re: Just a simple question - StrikerZ - 27.10.2016

BUMP


Re: Just a simple question - Maheerali - 28.10.2016

Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
PHP код:
enum fInfo
{
    
FacName[50],
    
FacOwner[20],
    
FacLevels,
    
FacRanks,
    
FacSlots[10//im not sure about this variable
}; 
PHP код:
new fact[100][fInfo];
stock NewFaction(nam[],ownername[],levels,ranks)
{
    new 
currentfaction+1;
    
format(fact[i][FacName],50,"%s"nam);
    
format(fact[i][FacOwner],20,"%s"ownername);
    
fact[i][FacLevels] = levels;
    
fact[i][FacRanks] = ranks;
}
CMD:createfac(playerid,params[])
{
    new 
name[50],owner[20],level,rank;
    if (
sscanf(params"ssii"nameowner,level,rank)) return SendClientMessage(playerid0xFF0000AA"Error")
    
NewFaction(name,ownername,level,ranks);
    
// Use Have to enter command like this /createfac Knights John 10 5