Hello (/setname) problem +REP
#2

Look this one isn't working too, it deletes the file without creating the new one..
Код:
CMD:setname(playerid, params[])
{
	new string[128], giveplayerid, name[MAX_PLAYER_NAME];
	new playername[MAX_PLAYER_NAME];
	if(sscanf(params, "us[24]", giveplayerid, name)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setname [playerid/partofname] [newname]");

	if(IsPlayerConnected(giveplayerid))
	{
		if(PlayerInfo[playerid][pAdmin] >= 4)
		{
			if(!INI_Exist(name))
			{
				new
					newname[MAX_PLAYER_NAME + 10];

				GetPlayerName(giveplayerid, playername, sizeof(playername));
				format(newname, sizeof(newname), "Accounts/%s.ini", name);
				format(string, sizeof(string), "{FF1B31}[Administration]{FFFFFF} %s has renamed %s to %s.", PlayerName(playerid), playername, newname);
				ABroadCast(COLOR_GRAD1,string,2);
				
				format(newname, sizeof(newname), "Accounts/%s.ini", playername);
				fremove(newname);

				if(INI_Exist(playername))  // If it doesn't get removed, blank the file with write io and check its length when a player attempts to authenticate (it'll be 0)
				{
					new File: BlankTheFile = fopen(newname, io_write);
					SendClientMessage(playerid, COLOR_GRAD2, "The old account couldn't be removed completely (it's been blanked for future use).");
					fclose(BlankTheFile);
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_WHITE, "This name is already registered.");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAD2, "You're not authorised to use this command.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "No Such Player");
	}
	return 1;
}
Reply


Messages In This Thread
Hello (/setname) problem +REP - by Antoniohl - 16.04.2015, 03:08
Re: Hello (/setname) problem +REP - by Antoniohl - 16.04.2015, 04:00
Respuesta: Hello (/setname) problem +REP - by JuanStone - 16.04.2015, 04:16
Re: Hello (/setname) problem +REP - by SickAttack - 16.04.2015, 06:32
Re: Hello (/setname) problem +REP - by iiNzTicTx - 16.04.2015, 09:03
Re: Hello (/setname) problem +REP - by Antoniohl - 16.04.2015, 16:57
Re: Hello (/setname) problem +REP - by Antoniohl - 16.04.2015, 21:55
Re: Hello (/setname) problem +REP - by Antoniohl - 17.04.2015, 03:22
Re: Hello (/setname) problem +REP - by Threshold - 17.04.2015, 09:03
Re: Hello (/setname) problem +REP - by Antoniohl - 17.04.2015, 16:50

Forum Jump:


Users browsing this thread: 2 Guest(s)