stock SaveFaction(factionid)
{
new file[60];
format(file, sizeof(file), FAC_FILE, factionid);
dini_IntSet(file, "ID", FI[factionid][eID]);
dini_Set(file, "Name", FI[factionid][eName]);
dini_FloatSet(file, "Interior_X", FI[factionid][EFPos][0]);
dini_FloatSet(file, "Interior_Y", FI[factionid][EFPos][1]);
dini_FloatSet(file, "Interior_Z", FI[factionid][EFPos][2]);
dini_FloatSet(file, "Outside_X", FI[factionid][OFPos][0]);
dini_FloatSet(file, "Outside_Y", FI[factionid][OFPos][1]);
dini_FloatSet(file, "Outside_Z", FI[factionid][OFPos][2]);
dini_Set(file, "Leader", FI[factionid][eLeader]);
dini_Set(file, "CoLeader", FI[factionid][eCoLeader]);
dini_Set(file, "Member_1", FI[factionid][eMember1]);
dini_Set(file, "Member_2", FI[factionid][eMember2]);
dini_Set(file, "Member_3", FI[factionid][eMember3]);
dini_Set(file, "Member_4", FI[factionid][eMember4]);
dini_Set(file, "Member_5", FI[factionid][eMember5]);
dini_Set(file, "Member_6", FI[factionid][eMember6]);
dini_Set(file, "Member_7", FI[factionid][eMember7]);
dini_Set(file, "Member_8", FI[factionid][eMember8]);
dini_Set(file, "Member_9", FI[factionid][eMember9]);
dini_Set(file, "Member_10", FI[factionid][eMember10]);
dini_Set(file, "Member_11", FI[factionid][eMember11]);
dini_Set(file, "Member_12", FI[factionid][eMember12]);
dini_Set(file, "Member_13", FI[factionid][eMember13]);
dini_Set(file, "Member_14", FI[factionid][eMember14]);
dini_Set(file, "Member_15", FI[factionid][eMember15]);
dini_Set(file, "Member_16", FI[factionid][eMember16]);
dini_Set(file, "Member_17", FI[factionid][eMember17]);
dini_Set(file, "Member_18", FI[factionid][eMember18]);
dini_Set(file, "Member_19", FI[factionid][eMember19]);
dini_Set(file, "Member_20", FI[factionid][eMember20]);
dini_IntSet(file, "Type", FI[factionid][eType]);
dini_IntSet(file, "Int", FI[factionid][eInt]);
dini_IntSet(file, "OutInt", FI[factionid][eOutInt]);
dini_IntSet(file, "VW", FI[factionid][eVW]);
dini_IntSet(file, "OutVW", FI[factionid][eOutVW]);
return 1;
}
stock CreateFaction(factionid, Name[64], Float:ExtX, Float:ExtY, Float:ExtZ, Float:IntX, Float:IntY, Float:IntZ, Type, EntInt, OutInt, EntVW, IntVW)
{
FI[factionid][eID] = factionid;
strmid(FI[factionid][eName], Name, 0, strlen(Name));
FI[factionid][EFPos][0] = IntX;
FI[factionid][EFPos][1] = IntY;
FI[factionid][EFPos][2] = IntZ;
FI[factionid][OFPos][0] = ExtX;
FI[factionid][OFPos][1] = ExtY;
FI[factionid][OFPos][2] = ExtZ;
FI[factionid][eType] = Type;
FI[factionid][eInt] = EntInt;
FI[factionid][eOutInt] = OutInt;
FI[factionid][eVW] = EntVW;
FI[factionid][eOutVW] = IntVW;
FI[factionid][ePickup] = CreatePickup(1239, 1, ExtX, ExtY, ExtZ, EntVW);
FI[factionid][eLabel] = Create3DTextLabel(Name, -1, ExtX, ExtY, ExtZ, 20.0, EntVW, 0);
CallLocalFunction("OnFactionCreate", "i", factionid);
return 1;
}
stock LoadFaction(factionid)
{
new file[60];
format(file, sizeof(file), FAC_FILE, factionid);
FI[factionid][eID] = dini_Int(file, "ID");
format(FI[factionid][eName], 24, dini_Get(file, "Name"));
FI[factionid][EFPos][0] = dini_Int(file, "Interior_X");
FI[factionid][EFPos][1] = dini_Int(file, "Interior_Y");
FI[factionid][EFPos][2] = dini_Int(file, "Interior_Z");
FI[factionid][OFPos][0] = dini_Int(file, "Outside_X");
FI[factionid][OFPos][1] = dini_Int(file, "Outside_Y");
FI[factionid][OFPos][2] = dini_Int(file, "Outside_Z");
format(FI[factionid][eLeader], 12, dini_Get(file, "Leader"));
format(FI[factionid][eCoLeader], 12, dini_Get(file, "CoLeader"));
format(FI[factionid][eMember1], 12, dini_Get(file, "Member_1"));
format(FI[factionid][eMember2], 12, dini_Get(file, "Member_2"));
format(FI[factionid][eMember3], 12, dini_Get(file, "Member_3"));
format(FI[factionid][eMember4], 12, dini_Get(file, "Member_4"));
format(FI[factionid][eMember5], 12, dini_Get(file, "Member_5"));
format(FI[factionid][eMember6], 12, dini_Get(file, "Member_6"));
format(FI[factionid][eMember7], 12, dini_Get(file, "Member_7"));
format(FI[factionid][eMember8], 12, dini_Get(file, "Member_8"));
format(FI[factionid][eMember9], 12, dini_Get(file, "Member_9"));
format(FI[factionid][eMember10], 12, dini_Get(file, "Member_10"));
format(FI[factionid][eMember11], 12, dini_Get(file, "Member_11"));
format(FI[factionid][eMember12], 12, dini_Get(file, "Member_12"));
format(FI[factionid][eMember13], 12, dini_Get(file, "Member_13"));
format(FI[factionid][eMember14], 12, dini_Get(file, "Member_14"));
format(FI[factionid][eMember15], 12, dini_Get(file, "Member_15"));
format(FI[factionid][eMember16], 12, dini_Get(file, "Member_16"));
format(FI[factionid][eMember17], 12, dini_Get(file, "Member_17"));
format(FI[factionid][eMember18], 12, dini_Get(file, "Member_18"));
format(FI[factionid][eMember19], 12, dini_Get(file, "Member_19"));
format(FI[factionid][eMember20], 12, dini_Get(file, "Member_20"));
FI[factionid][eType] = dini_Int(file, "Type");
FI[factionid][eInt] = dini_Int(file, "Int");
FI[factionid][eOutInt] = dini_Int(file, "OutInt");
FI[factionid][eVW] = dini_Int(file, "VW");
FI[factionid][eOutVW] = dini_Int(file, "OutVW");
CreateFaction(FI[factionid][eID],
FI[factionid][eName],
FI[factionid][OFPos][0],
FI[factionid][OFPos][1],
FI[factionid][OFPos][2],
FI[factionid][EFPos][0],
FI[factionid][EFPos][1],FI[factionid][EFPos][2],
FI[factionid][Type],
FI[factionid][Int],
FI[factionid][OutInt],
FI[factionid][VW],
FI[factionid][OutVW]);
return 1;
}
enum E_FAC_INFO
{
eID,
eName[64],
Float:EFPos[3],
Float:OFPos[3],
eLeader[MAX_PLAYER_NAME],
eCoLeader[MAX_PLAYER_NAME],
eMember1[MAX_PLAYER_NAME],
eMember2[MAX_PLAYER_NAME],
eMember3[MAX_PLAYER_NAME],
eMember4[MAX_PLAYER_NAME],
eMember5[MAX_PLAYER_NAME],
eMember6[MAX_PLAYER_NAME],
eMember7[MAX_PLAYER_NAME],
eMember8[MAX_PLAYER_NAME],
eMember9[MAX_PLAYER_NAME],
eMember10[MAX_PLAYER_NAME],
eMember11[MAX_PLAYER_NAME],
eMember12[MAX_PLAYER_NAME],
eMember13[MAX_PLAYER_NAME],
eMember14[MAX_PLAYER_NAME],
eMember15[MAX_PLAYER_NAME],
eMember16[MAX_PLAYER_NAME],
eMember17[MAX_PLAYER_NAME],
eMember18[MAX_PLAYER_NAME],
eMember19[MAX_PLAYER_NAME],
eMember20[MAX_PLAYER_NAME],
eType,
eInt,
eOutInt,
eVW,
eOutVW,
ePickup,
Text3D:eLabel
};
It doesnt create it by itself lol...
dini_Create is what u need. however, just cut the dini and go to sql. |
new file[60];
format(file, sizeof(file), "path"); //like Stuff.txt
because file = to nothing
PHP код:
|