SA-MP Forums Archive
Delete a file. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Delete a file. (/showthread.php?tid=88647)



Delete a file. - -eXo - 27.07.2009

How would I go about making a command so that when a player types /delete for example, it would delete a file with their name in script files folder named vehicles?

So basically

There is a file called First_Last.ini under Script Files / Vehicles
First_Last types /delete while connected to the server
The file First_Last.ini under Script Files / Vehicles is deleted.


Re: Delete a file. - ronyx69 - 28.07.2009

Код:
if(strcmp(cmd, "/delete", true) == 0)
	{
	new file;
	GetPlayerName(playerid, name, sizeof(name));
	format(file, sizeof(file), "/vehicles/%s.ini", udb_encode(name));
	if(dini_Exists(file))
		{
		dini_Remove(file);
		}
	return 1;
	}



Re: Delete a file. - -eXo - 28.07.2009

C:\Users\staples036\Downloads\RLRP V2\gamemodes\rlrp.pwn(30081) : error 017: undefined symbol "name"
C:\Users\staples036\Downloads\RLRP V2\gamemodes\rlrp.pwn(30081) : error 017: undefined symbol "name"
C:\Users\staples036\Downloads\RLRP V2\gamemodes\rlrp.pwn(30081) : error 029: invalid expression, assumed zero


Re: Delete a file. - saiberfun - 28.07.2009

pawn Код:
if(strcmp(cmd, "/delete", true) == 0)
    {
    new name;
    new file;
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), "/vehicles/%s.ini", udb_encode(name));
    if(dini_Exists(file))
        {
        dini_Remove(file);
        }
    return 1;
    }



Re: Delete a file. - -eXo - 28.07.2009

With that I get

C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(395) : error 035: argument type mismatch (argument 2)
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(395) : error 035: argument type mismatch (argument 2)
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(396) : error 035: argument type mismatch (argument 1)
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(396) : error 035: argument type mismatch (argument 1)
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(397) : error 017: undefined symbol "dini_Exists"
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(399) : error 017: undefined symbol "dini_Remove"
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(394) : warning 203: symbol is never used: "file"
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(393) : warning 203: symbol is never used: "name"


Re: Delete a file. - saiberfun - 28.07.2009

Quote:
Originally Posted by -eXo
With that I get

C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(395) : error 035: argument type mismatch (argument 2)
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(395) : error 035: argument type mismatch (argument 2)
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(396) : error 035: argument type mismatch (argument 1)
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(396) : error 035: argument type mismatch (argument 1)
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(397) : error 017: undefined symbol "dini_Exists"
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(399) : error 017: undefined symbol "dini_Remove"
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(394) : warning 203: symbol is never used: "file"
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(393) : warning 203: symbol is never used: "name"
which are line 395 - 399?


Re: Delete a file. - -eXo - 28.07.2009

Quote:

GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "/vehicles/%s.ini", udb_encode(name));
if(dini_Exists(file))
{
dini_Remove(file);




Re: Delete a file. - saiberfun - 28.07.2009

pawn Код:
if(strcmp(cmd, "/delete", true) == 0)
    {
    new name[MAX_PLAYER_NAME];
    new file[128];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), "/vehicles/%s.ini", udb_encode(name));
    if(dini_Exists(file))
        {
        dini_Remove(file);
        }
    return 1;
    }
guess like that if there are more errors tell me


Re: Delete a file. - -eXo - 28.07.2009

C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(396) : error 017: undefined symbol "udb_encode"
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(397) : error 017: undefined symbol "dini_Exists"
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(399) : error 017: undefined symbol "dini_Remove"


Re: Delete a file. - Daem - 28.07.2009

Quote:
Originally Posted by -eXo
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(396) : error 017: undefined symbol "udb_encode"
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(397) : error 017: undefined symbol "dini_Exists"
C:\Users\staples036\Downloads\RLRP V2\filterscripts\cars5.pwn(399) : error 017: undefined symbol "dini_Remove"
add
pawn Код:
#include <dini>