/deleteaccount - 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: /deleteaccount (
/showthread.php?tid=536371)
/deleteaccount -
Beckett - 09.09.2014
pawn Код:
#define PATH "/Main Server Folder/Accounts/%s.ini"
CMD:deleteaccount(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
new name[25],str[30];
if(sscanf(params,"s[25]",name)) return MSG(playerid,COLOR_RED,"SERVER: /deleteaccount [Firstname_Lastname]");
format(str, sizeof(str),PATH,name);
if(!fexist(str))
{
SFM(playerid,COLOR_RED,"SERVER: %s cannot be found in the database.",name);
}
else
{
SFM(playerid,WHITE,"SERVER: You have deleted the account %s.",name);
fremove(str);
}
}
return 1;
}
I believe there's something missing in the command but I can't figure what is it any help is appreciated.
Thanks.
Re: /deleteaccount -
dusk - 09.09.2014
The variable "str" is too small. Even yor path "/Main Server Folder/Accounts/%s.ini" is 35 characters, so when you add the name it might be up to 60 characters(35 + MAX_PLAYER_NAME(24) + 1) .
Increase str size to 60.
Re: /deleteaccount -
Rudey - 09.09.2014
Dusk is right. Remember that the path will be stored in str thus 30 is not sufficient. Good luck.
Re: /deleteaccount -
Beckett - 10.09.2014
Ohh right, thanks, appreciated mate.