How do I create Dynamic Factions? - 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: How do I create Dynamic Factions? (
/showthread.php?tid=298433)
How do I create Dynamic Factions? -
seanny - 20.11.2011
Hello, How do I create Dynamic Factions with ZCMD, Sscanf and Y_INI, There is one in the tutorial section but it is using strcmp, strtok and Dini, Any help would be appreciated and Rep+'ed, Thanks.
Re: How do I create Dynamic Factions? -
seanny - 21.11.2011
Bump...... I really would like to know, Free Rep for those who help me.
Re: How do I create Dynamic Factions? -
Ironboy - 21.11.2011
<REMOVED>
I thought CreateDynamicObjects ^^
Re: How do I create Dynamic Factions? -
manchestera - 21.11.2011
lookin in the tuts section i saw one in there for this.
Re: How do I create Dynamic Factions? -
Jakku - 21.11.2011
First, create an enum to store your faction data.
Example:
pawn Code:
#define MAX_FACTIONS 10
new FactionCount;
enum Factions
{
Name[32], //String, that's why [32] = length
Skin, //Integer
Weapons[5][2], //5 for example, use more if you need, [2] = ammo and weapon id
Float:PositionX,
Float:PositionY,
Float:PositionZ,
};
new Faction[MAX_FACTIONS][Factions];
Then you could create a function to create a faction (Easier for you if you create them from your gamemode)
pawn Code:
stock CreateFaction(name[], skin, Float:x, Float:y,Float:z)
{
FactionCount++;
new id = FactionCount;
Faction[id][Name] = name;
Faction[id][Skin] = skin;
Faction[id][PositionX] = x;
Faction[id][PositionY] = y;
Faction[id][PositionZ] = z;
printf("Faction created: %s", name);
//I let you configure the other things like weapons if you need them
}
Then under OnGameModeInit; create your factions:
pawn Code:
public OnGameModeInit()
{
CreateFaction("Example name", skinid, x,y,z);
CreateFaction("Example name 2", skinid, x,y,z);
return 1;
}
Hope you got my point