Hello, i wan make a command /createfaction and i wan to have factionid , ftag,fname and more but i have problem with that factionid.
I not know where to start to make it...
pawn Code:
enum Factions
{
fTag[10], //Tag like LSPD - for text file name
fName[60], // All name like - Los Santos Police Department
factionid, // id of faction - i not lnow how to make it...
Float:fX, // the spawn of faction
Float:fY, .....
Float:fZ, ......
fRank1[35], // rank 1 - leader i wan to rename it Leader like that , Leader[35],
fRank2[35], // ranks
fRank3[35], // etc
fRank4[35], // etc
fRank5[35], // etc
fRank6[35], // etc
fRank7[35], // etc
fRank8[35], // etc
fRank9[35], // etc
fRank10[35], // etc
fSkin1, //skins of the leader or , LeaderSkin,
fSkin2, //another skins
fSkin3, //etc
fSkin4, //etc
fSkin5, //etc
fSkin6, //etc
fSkin7, //etc
fSkin8, //etc
fSkin9, //etc
fSkin10, //etc
fJoinRank, // i make this for /invite command if you invite some one will be that rank.
fType, //Is a police faction , Army , illegal faction and more..
fRankAmount //How many ranks to have becouse not all factions have 10 ranks some have 5 ranks or smaller...d
};
new Factions[MAX_FACTIONS][Factions];
/createfaction [tag] , need to be like /createfaction LSPD and that need to make file in floder /Factions/%s.ini with file name LSPD.
But nutting happens...
1. Wrong topic
instead.
2. A few errors in it e.g. format(string3, sizeof(string3), Factions_FOLDER, ftag);
You missed out the ""s, %s and ftag would make it a number name rather than the name you typed. Just use tmp.
pawn Code:
if(strcmp(cmd, "/createfaction", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /createfaction [tag]");
return 1;
}
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][AdminLevel] == 1338)
{
new string3[126];
format(string3, sizeof(string3), "/Factions_FOLDER/%s",tmp);
new File: fFile = fopen(string3, io_write);
if (fFile)
{
new var[128];
format(var, 128, "fName=%s\n","None");fwrite(fFile, var);
format(var, 128, "fX=%f\n",0.000000);fwrite(fFile, var);
format(var, 128, "fY=%f\n",0.000000);fwrite(fFile, var);
format(var, 128, "fZ=%f\n",0.000000);fwrite(fFile, var);
format(var, 128, "fRank1=%d\n",0);fwrite(fFile, var);
format(var, 128, "fRank2=%d\n",0);fwrite(fFile, var);
format(var, 128, "fRank3=%d\n",0);fwrite(fFile, var);
format(var, 128, "fRank4=%d\n",0);fwrite(fFile, var);
format(var, 128, "fRank5=%d\n",0);fwrite(fFile, var);
format(var, 128, "fRank6=%d\n",0);fwrite(fFile, var);
format(var, 128, "fRank7=%d\n",0);fwrite(fFile, var);
format(var, 128, "fRank8=%d\n",0);fwrite(fFile, var);
format(var, 128, "fRank9=%d\n",0);fwrite(fFile, var);
format(var, 128, "fRank10=%d\n",0);fwrite(fFile, var);
format(var, 128, "fSkin1=%d\n",0);fwrite(fFile, var);
format(var, 128, "fSkin2=%d\n",0);fwrite(fFile, var);
format(var, 128, "fSkin3=%d\n",0);fwrite(fFile, var);
format(var, 128, "fSkin4=%d\n",0);fwrite(fFile, var);
format(var, 128, "fSkin5=%d\n",0);fwrite(fFile, var);
format(var, 128, "fSkin6=%d\n",0);fwrite(fFile, var);
format(var, 128, "fSkin7=%d\n",0);fwrite(fFile, var);
format(var, 128, "fSkin8=%d\n",0);fwrite(fFile, var);
format(var, 128, "fSkin9=%d\n",0);fwrite(fFile, var);
format(var, 128, "fSkin10=%d\n",0);fwrite(fFile, var);
format(var, 128, "fJoinRank=%d\n",0);fwrite(fFile, var);
format(var, 128, "fUseSkins=%d\n",0);fwrite(fFile, var);
format(var, 128, "fType=%d\n",0);fwrite(fFile, var);
format(var, 128, "fRankAmount=%d\n",0);fwrite(fFile, var);
fclose(fFile);
format(str, sizeof(str), "You make faction with tag %s", ftag);
SendClientMessage(playerid,COLOR_GRAD2, str);
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command!");
}
}
return 1;
}
I made that... now work fine