CMD:ban(playerid, params[])
{
if(PlayerInfo[playerid][Admin] < 1) return NotAdmin(playerid);
new id, reason[64];
if(sscanf(params, "us", id, reason))
{
SendClientMessage(playerid, c_green, "Usage: /ban [PLayerID/PartOfName] [Reason]");
return 1;
}
new string[128], Name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME], file[128], weapons[13][2];
GetPlayerName(playerid, Name, sizeof(Name));
GetPlayerName(id, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "%s has been banned by administrator %s. Reason: %s.", PlayerName, Name, reason);
SendClientMessageToAll(COLOR_RED, string);
format(file, sizeof(file), "RRP/BannedList/%s.ini", PlayerName);
if(!dini_Exists(file))
{
for(new i = 0; i < 13; i++)
{
new pIP[16], Float:x, Float:y, Float:z, pos[64], slota[64], wepo[64];
dini_Create(file);
dini_Set(file, "Reason", reason);
dini_Set(file, "Banner", Name);
GetPlayerIp(id, pIP, sizeof(pIP));
dini_Set(file, "IP", pIP);
dini_IntSet(file, "LastCar", PlayerInfo[id][LastCar]);
GetPlayerPos(id, x, y, z);
format(pos, sizeof(pos), "(%f, %f, %f)", x, y, z);
dini_Set(file, "Position", pos);
GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
format(slota, sizeof(slota), "Slot(%i):Weapon(%i) / Ammo(%i)", i, weapons[i][0], weapons[i][1]);
format(wepo, sizeof(wepo), "Weapons%d", i);
dini_Set(file, wepo, slota);
Ban(id);
return 1;
}
return 1;
}
return 0;
}
Are you aware that you are trying to create the same file 13 times? And that the player is already being disconnected after you have saved the very first weapon?
|