18.10.2009, 23:31
1. Wrong topic Scripting Discussion 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.
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;
}