05.05.2013, 22:23
Alright so, I have this code but it wont work. It reads the data well, and yes you can only ban the player that has a actual account (works) but the problem is that it doesnt write the Banned and the player doesnt get banned at all.
It says it bans him but it doesnt. Maybe I screwed something up.
Etc...
My overal save and load works, but when I ban them using this it wont work. Help please?
It says it bans him but it doesnt. Maybe I screwed something up.
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(playerid));
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;
}
#define UserPath "Users/%s.ini"
forward loadaccount_user(playerid, name[], value[]);
public loadaccount_user(playerid, name[], value[])
{
INI_String("Password", PlayerInfo[playerid][pPass],129);
INI_Int("AdminLevel",PlayerInfo[playerid][pAdminLevel]);
INI_Int("VIPLevel",PlayerInfo[playerid][pVIPlevel]);
INI_Int("Money",PlayerInfo[playerid][pMoney]);
INI_Int("Scores",PlayerInfo[playerid][pScores]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Kicks",PlayerInfo[playerid][pKicks]);
INI_Int("Warns",PlayerInfo[playerid][pWarns]);
INI_Int("Banned",PlayerInfo[playerid][pBanned]);
return 1;
}
Etc...
My overal save and load works, but when I ban them using this it wont work. Help please?