Re-write a line in dini(+REP)
#1

Hi guys,
Hum, the following cmd is supposed to open up a file, find a string and delete it's text(if the text even exists).
e.g, faction Ballas has been warned, it writes down a warning to their lowest warning available slot
let's say it's 1. So in the factionwarnings file, on Ballas1, it'll change the text from Ballas1="Powergaming" to Ballas="" but for some reason I can't get it working. If it works, then it sometimes remove a warning from a clear slot(without any warnings, the value is ""), or says that the slot is clear when it's not.

PHP код:
COMMAND:rfwarn(playeridparams[])
{
new 
ff[50];
    if(
PlayerInfo[playerid][power] < 11) return SendClientError(playeridCANT_USE_CMD);
    new 
iFactionwidiReasonMAX_STRING ];
    if( 
sscanf params"dds"iFactionwidiReason))  return SCP(playerid"[FactionID] [WarningID] [Reason]");
format(ffsizeof(ff), "%sWarnings"teamsGetTeam(iFaction) ][teamname]);
if(
dini_Int(factionwarningsff) == 0) return SendClientError(playerid"This faction has 0 warnings!");
        
format(iStrsizeof(iStr), "%s%d",  teamsGetTeam(iFaction) ][teamname], wid);
            if(!
strcmp(dini_Get(factionwarningsiStr), "")) return SendClientError(playerid"This slot is empty!");
                
dini_Set(factionwarningsiStr"");
                
                
dini_IntSet(factionwarningsff, (dini_Int(factionwarningsff) -1));
                                
format(iStrsizeof(iStr), "#[Faction Warning] %s has removed a faction-warned from %s. Reason: %s [%d/5]"RPName(playerid),  teamsGetTeam(iFaction) ][teamname], iReasondini_Int(factionwarningsff));
                
SendClientMessageToAdmins(iStrCOLOR_PLAYER_VLIGHTBLUE);
                                 
PlayerLoop(ii)
                     {
                         if(
GetPlayerFaction(ii) == iFaction)
                        
SendClientMessage(iiCOLOR_PLAYER_VLIGHTBLUEiStr);
                    }
             return 
SendClientInfo(playerid"Done");
            
// return 1;

+ REPing

Basically, if you didnt understand so far - I want this command to check whether a line equals to "", if so it should return an error, if not it should set it to "".
Reply


Messages In This Thread
Re-write a line in dini(+REP) - by Amit1998 - 23.03.2016, 13:58
Re: Re-write a line in dini(+REP) - by Yashas - 24.03.2016, 06:52

Forum Jump:


Users browsing this thread: 1 Guest(s)