Change all players files with 1 command
#1

Here is my code that i have made so far. There are a few things i need to do to fix it

Код:
	if(strcmp(cmd, "/deleteinactivecars", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(!(PlayerInfo[playerid][pAdmin] >= 3))
		{
	            return SendClientMessage(playerid,COLOR_GREY,"You are not authorized to use this command.");
		}
		format(string, sizeof(string), "%s.ini",tmp);
		if(dini_Exists(string))
   		{
   	            if(PlayerInfo[playerid][pActiveCars] <= 15)
   		    {
	   	        // my code to delete the car will be here
   		    }
   		    SendClientMessage(playerid, COLOR_GRAD1, "   Cars Deleted.");
   		}
		else
		{
		    SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use this command.");
		}
	    }
	    return 1;
	}
When an admin types /deleteinactivecars , I want it to delete all cars that are inactive for 15 days.

On this line:

Код:
format(string, sizeof(string), "%s.ini",tmp);
I need it to open all the player files, how can I make it do this?
Reply
#2

You cannot batch-open files like this.

The only way this would be possible if instead of storing the files by name you would store them by number, and you would loop through them.
pawn Код:
for(new i=0; i<9000; i++)
{
    new
        string[30]
    ;
    format(string, 30, "%d.ini", i);
    // delete code here
}
You should look into the YSF plugin, I think he made something that suits your needs
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)