CreateDynamicFaction(iFac)
{
new Filename[64], line[256];
format(Filename, sizeof(Filename), FACTION_SYSTEM_File_PATH "Factions.ini");
new File:handle = fopen(Filename, io_write);
format(line, sizeof(line), "Faction Name=%s\r\n", arrFaction[iFac][g_szFactionName]); fwrite(handle, line);
format(line, sizeof(line), "Faction ID=%i\r\n", arrFaction[iFac][g_iFactionID] = iFac); fwrite(handle, line);
format(line, sizeof(line), "Locker VW=%d\r\n", arrFaction[iFac][g_iLockerVW]); fwrite(handle, line);
format(line, sizeof(line), "Faction Type=%d\r\n", arrFaction[iFac][g_iFactionType]); fwrite(handle, line);
format(line, sizeof(line), "Locker Guns=%i\r\n", arrFaction[iFac][g_iLockerGuns]); fwrite(handle, line);
format(line, sizeof(line), "Locker Costing=%i\r\n", arrFaction[iFac][g_iLockerCost]); fwrite(handle, line);
format(line, sizeof(line), "Allegiance=%d\r\n", arrFaction[iFac][g_iAllegiance]); fwrite(handle, line);
format(line, sizeof(line), "Radio Access=%d\r\n", arrFaction[iFac][g_iRadioAccess]); fwrite(handle, line);
format(line, sizeof(line), "Locker Stock=%i\r\n", arrFaction[iFac][g_iLockerStock]);
format(line, sizeof(line), "--------------------------------");
fwrite(handle, line);
fclose(handle);
}
0|1|84|||0.000000|0.000000|0.000000|0.000000|0.000 000|0.000000|0.000000|0.000000|0|0|0|0|$0|0 |
CMD:createfaction(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 4) { new iFac = getFreeFaction(), amount, weapons, string[128]; if(iFac == -1) { return SendClientMessage(playerid, -1, "There is too many factions."); } if(sscanf(params, "s[64]d", arrFaction[iFac][g_szFactionName], amount, weapons)) { return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /createfaction [name] [type(/factypes)]"); } format(string, sizeof(string), "You have created a faction called %s, faction ID %i & type %d has been assigned to it!", arrFaction[iFac][g_szFactionName], iFac, amount); arrFaction[iFac][g_iFactionType] = amount; SendClientMessageEx(playerid, COLOR_WHITE, string); CreateDynamicFaction(iFac); SaveDynamicFaction(); format(string, sizeof(string), "FACTION: %s has created a facton called %s, ID %i, type %i.", GetPlayerNameEx(playerid), arrFaction[iFac][g_szFactionName], iFac, amount); Log("logs/factions.log", string); } return 1; } |
Could you stop coming here with every problem what you have? Its a tenth topic which i replying you. If you want to create a Gamemode then learn some scripting basics then go and do a RolePlay GM. I don't know why you're started of doing this GameMode.. that's a hard way of the first project.
By the way, show where you saving this code. |
SaveDynamicFaction() {
new
szFileStr[1024],
File: fHandle = fopen("Factions/Factions.cfg", io_write);
for(new iIndex; iIndex < MAX_GROUPS; iIndex++) {
format(szFileStr, sizeof(szFileStr), "%i|%i|%d|%s|%s|%f|%f|%f|%f|%f|%f|%f|%f|%d|%d|%d|%d|$%i|%d\r\n",
arrFaction[iIndex][g_iFactionID],
arrFaction[iIndex][g_iFactionType],
arrFaction[iIndex][g_szFactionName],
arrFaction[iIndex][g_iLockerGuns],
arrFaction[iIndex][g_iLockerCost],
arrFaction[iIndex][g_iAllegiance],
arrFaction[iIndex][g_iBugAccess],
arrFaction[iIndex][g_iChatAccess],
arrFaction[iIndex][g_iRadioAccess],
arrFaction[iIndex][g_iDeptRadioAccess],
arrFaction[iIndex][g_hDutyColour],
arrFaction[iIndex][g_hRadioColour],
arrFaction[iIndex][g_iShareAssets],
arrFaction[iIndex][g_iLockerStock],
arrFaction[iIndex][g_fLockerPos],
arrFaction[iIndex][g_iLockerVW],
arrFaction[iIndex][g_fCratePos],
arrFaction[iIndex][g_iFacVault],
arrFaction[iIndex][g_t3DLabels]
);
fwrite(fHandle, szFileStr);
}
fclose(fHandle);
return 1;
}
Just throwing this out there, the NGRP script is NOT a good gamemode for beginners. Unless of course you feel like breaking your brain.
|