invite, uninvite, giverank = conversion.
#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


Messages In This Thread
invite, uninvite, giverank = conversion. - by DamonD - 13.10.2013, 19:25
Re: invite, uninvite, giverank = conversion. - by DanishHaq - 13.10.2013, 19:58

Forum Jump:


Users browsing this thread: 1 Guest(s)