Campfire help
#1

PHP код:
CMD:addfire(playeridparams[])
{
    if(
pInfo[playerid][pAdminLevel] < 4) return SendClientMessage(playeridCOLOR_RED"<!> You are not authorized to use that command!");
    new
        
string[128],
        
fid,
        
Float:p_Pos[4]
    ;
    if(
sscanf(params"i"fid)) return SendClientMessage(playeridCOLOR_YELLOW"USAGE: /addfire <campfireid>");
    if(
fid || fid MAX_SLOTS) return SendClientMessage(playeridCOLOR_RED"<!> Do not exceed the campfire limitations.");
    if(
fexist(FPath(fid))) return SendClientMessage(playeridCOLOR_RED"<!> Campfire ID used.");
    
GetPlayerPos(playeridp_Pos[0], p_Pos[1], p_Pos[2]);
    
GetPlayerFacingAngle(playeridp_Pos[3]);
    
    
CreateObjectCampfire(fidp_Pos[0], p_Pos[1], p_Pos[2], p_Pos[3]);
    
format(stringsizeof(string), "<!> Campfire ID %d created."fid);
    
SendClientMessage(playeridCOLOR_GREENstring);
    
    
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;

Why does it create a file named 90, even if I used /addfire 0
Reply
#2

Found a fix. Just don't know how to create one. Need help

PHP код:
stock UserPath(playerid)
{
    new 
str[128],name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,sizeof(name));
    
format(str,sizeof(str),UPath,name);
    return 
str;
}

/* Something like this, but for the campfire 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)