SA-MP Forums Archive
That family name is already taken. - 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: That family name is already taken. (/showthread.php?tid=362470)



That family name is already taken. - Goru - 24.07.2012

Код:
CMD:buyfamily(playerid) return cmd_createfamily(playerid);
CMD:createfamily(playerid)
{
    if(PlayerInfo[playerid][pLevel] < 5)
    {
        SCM(playerid, COLOR_GREY, "   You need at least level 5 to create families!");
        return 1;
	}
    if(PlayerInfo[playerid][pWarnings] > 0)
    {
	    SCM(playerid, COLOR_GREY,"	You can't create a family if you have warnings!");
	    return 1;
	}
	new string[128];
    if(!FamApproved[playerid] && PlayerInfo[playerid][pAdmin] < 2)
    {
		foreach(Player, i)
		{
		    if(PlayerInfo[i][pAdmin] >= 2)
		    {
				format(string, sizeof(string), "AdmCmd: %s requests to create a family. (Acceptfamily/Declinefamily)", PlayerName(playerid));
				ABroadCast(COLOR_YELLOW, string, 1);
				SCM(playerid, COLOR_LIGHTGREEN, "* A request has been sent to the admins.");
				SCM(playerid, COLOR_BRIGHTRED, "*** APPLY ON THE FORUM TO CREATE A FAMILY! ***");
				return 1;
		    }
		}
		SCM(playerid, COLOR_GREY, "   There are no admins on right now!");
    }
    else
    {
	    if(!IsPlayerBlocked(playerid))
		{
		    new MCreator[MAX_PLAYER_NAME];
			GetPlayerName(playerid, MCreator, sizeof(MCreator));
	        FamilyLoop(f)
			{
			    if(IsAFamily(f))
			    {
				    if(!strcmp(MCreator, FamilyInfo[f][fCreator]))
					{
					    SCM(playerid, COLOR_GREY,"	You already own a family!");
						return 1;
					}
				}
			}
	        if(IsAMember(playerid) || PlayerInfo[playerid][pMember] > 0)
	        {
			    SCM(playerid, COLOR_GREY,"	You are already in a family/faction!");
			    return 1;
			}
			if(GetPlayerMoneyEx(playerid) < 500000)
			{
			    SCM(playerid, COLOR_GREY,"	You need $500,000 to create a family!");
			    return 1;
			}
			SCM(playerid, COLOR_LIGHTGREEN,"* Starting family creation....");
			new found = NewFamilySlot();
			if(found == -1)
			{
			    SCM(playerid, COLOR_GREY,"	All family spots are already taken!");
			    SCM(playerid, COLOR_GREY,"	Please wait until a family quits.");
			    TogglePlayerControllable(playerid, 1);
			    return 1;
			}
			ShowPlayerDialog(playerid, 103, DIALOG_STYLE_INPUT, "{00BFFF}East Coast Roleplay Family Assistant", "{FFFFFF}Please enter a name for your family.", "Confirm", "Cancel");
			return 1;
		}
		else
		{
		    SCM(playerid, COLOR_GREY, "   You can't do that right now!");
		    return 1;
		}
	}
	return 1;
}
I've been trying to fix all day! Just need help..