Factions.
#1

Hello. I tried to make factions. I started with /Invite, /MakeLeader command.

pawn Код:
CMD:makeleader(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new ID;
        new Factiune;
        new level;
        level = Factiune;
        new nume[MAX_PLAYER_NAME];
        new name[MAX_PLAYER_NAME];
        new string[128];
        if(sscanf(params,"ui", ID, Factiune)) return SendClientMessage(playerid,-1,"{FF0000}Folosire {15FF00}/MakeLeader [ID] [FactiuneID]");
        GetPlayerName(playerid, nume, sizeof(nume));
        GetPlayerName(ID, name, sizeof(name));
        if(level > 16 || level < 0)
        {
            SendClientMessage(playerid, -1, "{FFCC33}Numarul factiunii este invalid!");
            return 1;
        }
        if(level == 0)
        {
            LiderInfo[playerid][Nimic] = 1;
            format(string, sizeof(string), "{FFCC33}Ai fost setat ca fiind un {FF0000}Civil {FFCC33}de Admin-ul {FF0000}%s {FFCC33}!", nume);
            SendClientMessage(ID, -1, string);
            format(string, sizeof(string), "{FFCC33}I-ai setat lui {FF0000}%s {FFCC33}rank de: {FF0000}Civil{FFCC33}!", name);
            SendClientMessage(ID, -1, string);
        }
        else if(level == 1)
        {
            LiderInfo[playerid][LiderG] = 1;
            format(string, sizeof(string), "{FFCC33}Ai fost setat ca fiind lider la {FF0000}Groove Street {FFCC33}de Admin-ul {FF0000}%s {FFCC33}!", nume);
            SendClientMessage(ID, -1, string);
            format(string, sizeof(string), "{FFCC33}I-ai setat lui {FF0000}%s {FFCC33}Lider la: {FF0000}Groove Street{FFCC33}!", name);
            SendClientMessage(ID, -1, string);
        }
        else if(level == 2)
        {
            LiderInfo[playerid][LiderL] = 1;
            format(string, sizeof(string), "{FFCC33}Ai fost setat ca fiind lider la {FF0000}Familia Leonte {FFCC33}de Admin-ul {FF0000}%s {FFCC33}!", nume);
            SendClientMessage(ID, -1, string);
            format(string, sizeof(string), "{FFCC33}I-ai setat lui {FF0000}%s {FFCC33}Lider la: {FF0000}Familia Leonte{FFCC33}!", name);
            SendClientMessage(ID, -1, string);
        }
    }
    else
    {
        SendClientMessage(playerid, -1, "{FFCC33}EROARE: {15FF00}Nu esti {FFCC33}RCON!");
    }
    return 1;
}

//-----------------------------LIDERI-------------------------------------------

CMD:invite(playerid, params[])
{
    new ID;
    new string[128];
    new nume[MAX_PLAYER_NAME];
    new name[MAX_PLAYER_NAME];
    if(sscanf(params,"u", ID)) return SendClientMessage(playerid,-1,"{FF0000}Folosire {15FF00}/Invite [ID]");
    GetPlayerName(playerid, nume, sizeof(nume));
    GetPlayerName(ID, name, sizeof(name));
    if(LiderInfo[playerid][LiderG] == 1)
    {
        format(string, sizeof(string), "{FFCC33}Ai fost invitat de {FF0000}%s {FFCC33}in factiunea {FF0000}Groove Street {FFCC33}!", nume);
        SendClientMessage(ID, -1, string);
        format(string, sizeof(string), "{FFCC33}Scrie {FF0000}/accept {FFCC33}pentru a accepta!");
        SendClientMessage(ID, -1, string);
        format(string, sizeof(string), "{FFCC33}L-ai invitat pe {FF0000}%s {FFCC33}in factiune!", name);
        SendClientMessage(playerid, -1, string);
    }
    else if(LiderInfo[playerid][LiderL] == 1)
    {
        format(string, sizeof(string), "{FFCC33}Ai fost invitat de {FF0000}%s {FFCC33}in factiunea {FF0000}Familia Leonte{FFCC33}!", nume);
        SendClientMessage(ID, -1, string);
        format(string, sizeof(string), "{FFCC33}Scrie {FF0000}/accept {FFCC33}pentru a accepta!");
        SendClientMessage(ID, -1, string);
        format(string, sizeof(string), "{FFCC33}L-ai invitat pe {FF0000}%s {FFCC33}in factiune!", name);
        SendClientMessage(playerid, -1, string);
    }
    return 1;
}
Look here enums:

pawn Код:
enum lInfo
{
    LiderG,
    LiderL,
    Nimic
}
new LiderInfo[MAX_PLAYERS][lInfo];
But I'm stuck. With these commands, and enums, how can I make an /Accept command? How to start? +Rep for helper.
Reply
#2

Код:
new PlayerInvited[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
	PlayerInvited[playerid] = -1;
	return 1;
}

CMD:invite(playerid, params[])
{
    new ID;
    new string[128];
    new nume[MAX_PLAYER_NAME];
    new name[MAX_PLAYER_NAME];
    if(sscanf(params,"u", ID)) return SendClientMessage(playerid,-1,"{FF0000}Folosire {15FF00}/Invite [ID]");
    GetPlayerName(playerid, nume, sizeof(nume));
    GetPlayerName(ID, name, sizeof(name));
    if(LiderInfo[playerid][LiderG] == 1)
    {
        format(string, sizeof(string), "{FFCC33}Ai fost invitat de {FF0000}%s {FFCC33}in factiunea {FF0000}Groove Street {FFCC33}!", nume);
        SendClientMessage(ID, -1, string);
        format(string, sizeof(string), "{FFCC33}Scrie {FF0000}/accept {FFCC33}pentru a accepta!");
        SendClientMessage(ID, -1, string);
        format(string, sizeof(string), "{FFCC33}L-ai invitat pe {FF0000}%s {FFCC33}in factiune!", name);
        SendClientMessage(playerid, -1, string);
        PlayerInvited[ID] = 1;
    }
    else if(LiderInfo[playerid][LiderL] == 1)
    {
        format(string, sizeof(string), "{FFCC33}Ai fost invitat de {FF0000}%s {FFCC33}in factiunea {FF0000}Familia Leonte{FFCC33}!", nume);
        SendClientMessage(ID, -1, string);
        format(string, sizeof(string), "{FFCC33}Scrie {FF0000}/accept {FFCC33}pentru a accepta!");
        SendClientMessage(ID, -1, string);
        format(string, sizeof(string), "{FFCC33}L-ai invitat pe {FF0000}%s {FFCC33}in factiune!", name);
        SendClientMessage(playerid, -1, string);
		PlayerInvited[ID] = 1;
    }
    return 1;
}

CMD:accept(playerid, params[])
{
	if(PlayerInvited[playerid] == -1)
	{
	    //Not invited.
	}
	if(PlayerInvited[playerid] == 0)
	{
	    //Invited to Groove Street.
	}
	if(PlayerInvited[playerid] == 1)
	{
	    //Invited to Familla Leonte.
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)