/removeacc - 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)
+--- Thread: /removeacc (
/showthread.php?tid=318226)
/removeacc -
viddo - 14.02.2012
I want to create a /removeacc Or /deleteacc for admins that delete the account from it's data base, the game mode is Larp god father edit admin system.
AW: /removeacc -
Dripac - 14.02.2012
pawn Код:
if(!strcmp(cmd, "/deletefile", true))
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /deletefile [file] File = Path + File + File end(ex - .txt)");
if(!fexist(tmp)) return SendClientMessage(playerid, COLOR_RED, "This file doesn't exist!");
new stringgg[256];
new File:file = fopen(tmp, io_read);
format(str, sizeof str, "%s_backup.back", tmp);
new File:backup = fopen(str, io_write);
while(fread(file, stringgg))
{
format(stringgg, sizeof stringgg, "%s\n", string);
fwrite(backup, stringgg);
}
fclose(file);
fremove(tmp);
fclose(backup);
new stringg[100];
format(stringg, sizeof stringg, "%s was deleted! The file %s was created as a backup in the same folder.", tmp, str);
SendClientMessage(playerid, COLOR_YELLOW, stringg);
}
}
Try it, i didn't test it yet.
Re: /removeacc -
KingHual - 14.02.2012
Are you using a mysql plugin? An ini system? The default file system? Give more info.
Re: AW: /removeacc -
viddo - 14.02.2012
Quote:
Originally Posted by Dripac
pawn Код:
if(!strcmp(cmd, "/deletefile", true)) { if(PlayerInfo[playerid][pAdmin] >= 5) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /deletefile [file] File = Path + File + File end(ex - .txt)"); if(!fexist(tmp)) return SendClientMessage(playerid, COLOR_RED, "This file doesn't exist!"); new stringgg[256]; new File:file = fopen(tmp, io_read); format(str, sizeof str, "%s_backup.back", tmp); new File:backup = fopen(str, io_write); while(fread(file, stringgg)) { format(stringgg, sizeof stringgg, "%s\n", string); fwrite(backup, stringgg); } fclose(file); fremove(tmp); fclose(backup); new stringg[100]; format(stringg, sizeof stringg, "%s was deleted! The file %s was created as a backup in the same folder.", tmp, str); SendClientMessage(playerid, COLOR_YELLOW, stringg); } }
Try it, i didn't test it yet.
|
Код:
C:\Users\Viddo\Desktop\LARP 4.0\LARP 4.0 D\gamemodes\larp.pwn(25874) : error 017: undefined symbol "str"
C:\Users\Viddo\Desktop\LARP 4.0\LARP 4.0 D\gamemodes\larp.pwn(25874) : error 017: undefined symbol "str"
C:\Users\Viddo\Desktop\LARP 4.0\LARP 4.0 D\gamemodes\larp.pwn(25875) : error 017: undefined symbol "str"
C:\Users\Viddo\Desktop\LARP 4.0\LARP 4.0 D\gamemodes\larp.pwn(25885) : error 017: undefined symbol "str"
EDIT: nvm i fixed it but i really dont understand how it fully works, If i want to delete the account i need to type the full path of where the player's file is located ? I wanted to make it more like /deleteacc [Player_Name] And it locates this name from the script files and removes it