invite, uninvite, giverank = conversion.
#1

I need to know, or I need you guys to convert this to a single ZCMD CMD:. So it would be /invite [playerid], /uninvite [playerid] and /giverank [playerid] [rank]. But only r5+, fam members can use it.

Код:
Код:
Код:
else if(strcmp(choice,"invite",true) == 0)
		{
			if(!strlen(opstring))
			{
				SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /adjust invite [player]");
				return 1;
			}
			new giveplayerid = ReturnUser(opstring);
			if(IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					if (PlayerInfo[giveplayerid][pFMember] == 255)
					{
						// No more of this shit, our system is not designed for this
						/*if(PlayerInfo[giveplayerid][pLeader] == 2 || PlayerInfo[giveplayerid][pMember] == 2 && PlayerInfo[giveplayerid][pDivision] == 2)
						{
							if(PlayerInfo[giveplayerid][pGangWarn] >= 3)
							{
								SendClientMessageEx(playerid, COLOR_WHITE, "That player can not be invited. They are banned from being in a gang.");
								return 1;
							}
							format(string, sizeof(string), "* You've invited %s to join '%s'.",GetPlayerNameEx(giveplayerid), FamilyInfo[family][FamilyName]);
							SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string), "* %s has invited you to join '%s'. (type /accept family)",GetPlayerNameEx(playerid), FamilyInfo[family][FamilyName]);
							SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
							InviteFaction[giveplayerid] = 0;
							InviteOffer[giveplayerid] = playerid;
							InviteFamily[giveplayerid] = family;
						}*/
						if(PlayerInfo[giveplayerid][pLeader] == 0 && PlayerInfo[giveplayerid][pMember] == 0)
						{
							if(PlayerInfo[giveplayerid][pGangWarn] >= 3)
							{
								SendClientMessageEx(playerid, COLOR_WHITE, "That player can not be invited. They are banned from being in a gang.");
								return 1;
							}
							format(string, sizeof(string), "* You've invited %s to join '%s'.",GetPlayerNameEx(giveplayerid), FamilyInfo[family][FamilyName]);
							SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string), "* %s has invited you to join '%s'. (type /accept family)",GetPlayerNameEx(playerid), FamilyInfo[family][FamilyName]);
							SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
							InviteFaction[giveplayerid] = 0;
							InviteOffer[giveplayerid] = playerid;
							InviteFamily[giveplayerid] = family;
							format(string, sizeof(string), "%s invited %s to family %d ", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), family+1);
							Log("logs/family.log", string);
						}
						else
						{
							SendClientMessageEx(playerid, COLOR_GREY, "That player is already in a family/faction.");
						}
					}
					else
					{
						SendClientMessageEx(playerid, COLOR_GREY, "That player is already in a family/faction.");
					}
					return 1;
				}
			}
			else
			{
				SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
				return 1;
			}
		}
		else if(strcmp(choice,"uninvite",true) == 0)
		{
			if(!strlen(opstring))
			{
				SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /adjust uninvite [player]");
				return 1;
			}
			new giveplayerid = ReturnUser(opstring);
			if(IsPlayerConnected(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					if(PlayerInfo[giveplayerid][pFMember] != family)
					{
						SendClientMessageEx(playerid, COLOR_GREY, "That player isn't in your family.");
						return 1;
					}
					if(PlayerInfo[giveplayerid][pRank] > PlayerInfo[playerid][pRank])
					{
						SendClientMessageEx(playerid, COLOR_GREY, "You can't uninvite higher ranks.");
						return 1;
					}
					format(string, sizeof(string), "* You've kicked %s out of your family.",GetPlayerNameEx(giveplayerid));
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
					format(string, sizeof(string), "* Family leader %s has kicked your out of the family.",GetPlayerNameEx(playerid));
					SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
					PlayerInfo[giveplayerid][pFMember] = 255;
					PlayerInfo[giveplayerid][pRank] = 0;
					FamilyInfo[family][FamilyMembers] --;
					SaveFamilies();
					format(string, sizeof(string), "%s uninvited %s from family %d ", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), family+1);
					Log("logs/family.log", string);
					return 1;
				}
			}
			else
			{
				SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
				return 1;
			}
		}
Reply
#2

Not tested / compiled or whatever:

pawn Код:
CMD:invite(playerid, params[])
{
    if(PlayerInfo[playerid][pLeader] == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "Error: You're not a leader.");
    new giveplayerid, string[100];
    if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "Syntax: /invite [playerid/name]");
    if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFFFFFFFF, "Error: Player not connected.");
    if(PlayerInfo[giveplayerid][pFMember] != 255 || PlayerInfo[giveplayerid][pMember] != 0 || PlayerInfo[giveplayerid][pLeader] != 0) return SendClientMessage(playerid, 0xFFFFFFFF, "That player can't be invited because he's already in a faction.");
    if(PlayerInfo[giveplayerid][pGangWarn] >= 3) return SendClientMessage(playerid, 0xFFFFFFFF, "That player is banned from being in gangs.");
    format(string, sizeof(string), "* You've invited %s to join '%s'.",GetPlayerNameEx(giveplayerid), FamilyInfo[family][FamilyName]);
    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "* %s has invited you to join '%s'. (type /accept family)",GetPlayerNameEx(playerid), FamilyInfo[family][FamilyName]);
    SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
    InviteFaction[giveplayerid] = 0;
    InviteOffer[giveplayerid] = playerid;
    InviteFamily[giveplayerid] = PlayerInfo[playerid][pLeader];
    format(string, sizeof(string), "%s invited %s to family %d ", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), family+1);
    Log("logs/family.log", string);
    return 1;
}

CMD:uninvite(playerid, params[])
{
    new giveplayerid, string[100];
    if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "Syntax: /uninvite [playerid/name]");
    if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFFFFFFFF, "Error: Player not connected.");
    if(PlayerInfo[giveplayerid][pFMember] != PlayerInfo[playerid][pLeader]) return SendClientMessage(playerid, 0xFFFFFFFF, "That player isn't in your family.");
    if(PlayerInfo[playerid][pRank] < PlayerInfo[giveplayerid][pRank]) return SendClientMessage(playerid, 0xFFFFFFFF, "You can't uninvite higher ranks.");
    format(string, sizeof(string), "* You've kicked %s out of your family.",GetPlayerNameEx(giveplayerid));
    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "* Family leader %s has kicked your out of the family.",GetPlayerNameEx(playerid));
    SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
    PlayerInfo[giveplayerid][pFMember] = 255;
    PlayerInfo[giveplayerid][pRank] = 0;
    FamilyInfo[family][FamilyMembers] --;
    SaveFamilies();
    format(string, sizeof(string), "%s uninvited %s from family %d ", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), family+1);
    Log("logs/family.log", string);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)