25.11.2016, 12:59
PHP код:
CMD:addfire(playerid, params[])
{
if(pInfo[playerid][pAdminLevel] < 4) return SendClientMessage(playerid, COLOR_RED, "<!> You are not authorized to use that command!");
new
string[128],
fid,
Float:p_Pos[4]
;
if(sscanf(params, "i", fid)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /addfire <campfireid>");
if(fid < 0 || fid > MAX_SLOTS) return SendClientMessage(playerid, COLOR_RED, "<!> Do not exceed the campfire limitations.");
if(fexist(FPath(fid))) return SendClientMessage(playerid, COLOR_RED, "<!> Campfire ID used.");
GetPlayerPos(playerid, p_Pos[0], p_Pos[1], p_Pos[2]);
GetPlayerFacingAngle(playerid, p_Pos[3]);
CreateObjectCampfire(fid, p_Pos[0], p_Pos[1], p_Pos[2], p_Pos[3]);
format(string, sizeof(string), "<!> Campfire ID %d created.", fid);
SendClientMessage(playerid, COLOR_GREEN, string);
fInfo[fid][fSlot] = fid;
fInfo[fid][fxPos] = p_Pos[0];
fInfo[fid][fyPos] = p_Pos[1];
fInfo[fid][fzPos] = p_Pos[2];
fInfo[fid][faAng] = p_Pos[3];
SaveFStats(fid);
return 1;
}
forward SaveFStats(fid);
public SaveFStats(fid)
{
new INI:File = INI_Open(FPath(fid));
INI_SetTag(File,"CampfireData");
INI_WriteInt(File,"Slot",fInfo[fid][fSlot]);
INI_WriteFloat(File,"PosX",fInfo[fid][fxPos]);
INI_WriteFloat(File,"PosY",fInfo[fid][fyPos]);
INI_WriteFloat(File,"PosZ",fInfo[fid][fzPos]);
INI_WriteFloat(File,"Angle",fInfo[fid][faAng]);
INI_Close(File);
return 1;
}