Raw file functions
#1

Hey guys, i was making a deletemap command suddenly it didnt work out great.

Now the main purpose of this command is to clear a line from a file, clearly it didnt do that :/
I know i did something wrong because it just deleted the name and the other maps.

MAPS_FILE = maps.txt

Now the MAPS_FILE Format looks like this

Код:
lorenc, [tSk]Lorenc, 146.46, -73.30, 1.42
Creates&Guns, [tSk]Lorenc, 2581.47, 2828.23, 11.86
Mapname, Author and Co-ordinates.

Now i want completely the whole line to be deleted when i type /deletemap Creates&Guns
it'll remove the line Creates&Guns. I've gathered a function from the wiki called fdeleteline for this case.

This is my command. I'm completely useless when it comes to RAW file functions.

pawn Код:
CMD:deletemap(playerid, params[])
{
    new
        linewao[MAX_MAP_NAME];
   
    /*if(!IsPlayerAdmin(playerid)) return 0;
    else */
if(sscanf(params, "s[30]", linewao)) SendUsage(playerid, "/deletemap [mapname]");
    else if(strlen(linewao) > MAX_MAP_NAME) return SendError(playerid, "Max characters is 30");
    {
        fdeleteline(MAPS_FILE, linewao);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: