20.11.2011, 17:25
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.
#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];
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
}
public OnGameModeInit()
{
CreateFaction("Example name", skinid, x,y,z);
CreateFaction("Example name 2", skinid, x,y,z);
return 1;
}