Banning offline player - 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: Banning offline player (
/showthread.php?tid=435463)
Banning offline player -
Squirrel - 07.05.2013
Alright so, I've been trying to get this to work but it keeps failing.
It wont ban the player at all.
pawn Код:
CMD:banofflineplayer(playerid, params[])
{
new targetname[24], filestring[79];
if(PlayerInfo[playerid][pAdminLevel] >= 5)
{
if(sscanf(params, "s[24]", targetname)) return SendClientMessage(playerid, -1, "Correct Usage: /banofflineplayer [Player's Name]");
format(filestring, sizeof(filestring), "Users/%s.ini", targetname);
if(!fexist(filestring)) return SendClientMessage(playerid, -1, "Error: The player name you have chosen was not found in our system.");
else
{
new INI:file = INI_Open(Path(targetname));
INI_SetTag(file, "Player's Data");
INI_WriteInt(file, "Banned", 1);
INI_Close(file);
new done[128];
format(done, sizeof(done), "You have banned %s", targetname);
SendClientMessage(playerid,-1 , done);
}
}
return 1;
}
This is my path
pawn Код:
#define UserPath "Users/%s.ini"
stock Path(playerid)
{
new str[128],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(str,sizeof(str),UserPath,name);
return str;
}
Also I am getting error.
pawn Код:
error 035: argument type mismatch (argument 1)
Target line is
pawn Код:
new INI:file = INI_Open(Path(targetname));
Re: Banning offline player -
ryansheilds - 07.05.2013
... Change
pawn Код:
INI_Open(Path(targetname))
to 'filestring', so;