SA-MP Forums Archive
Faction Chat Help - 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: Faction Chat Help (/showthread.php?tid=575742)



Faction Chat Help - DTV - 29.05.2015

pawn Код:
CMD:faction(playerid, params[])
{
    if(GetPVarInt(playerid, "LoggedIn") == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, ADMIN);
    new string[128], message[100], rank, fid = Player[playerid][FactionID];
    if(Player[playerid][FactionID] != 0)
    {
        if(sscanf(params, "s[100]", message)) return SendClientMessage(playerid, COLOR_GREY, "[Server Command]: /f[action] [message]");
        if(Player[playerid][Rank] == 1) rank = Faction[fid][F1Rank];
        else if(Player[playerid][Rank] == 2) rank = Faction[fid][F2Rank];
        else if(Player[playerid][Rank] == 3) rank = Faction[fid][F3Rank];
        else if(Player[playerid][Rank] == 4) rank = Faction[fid][F4Rank];
        else if(Player[playerid][Rank] == 5) rank = Faction[fid][F5Rank];
        else if(Player[playerid][Rank] == 6) rank = Faction[fid][F6Rank];
        format(string, sizeof(string), "(( %s [%s] says: %s ))", GetName(playerid), rank, message);
        FactionChat(Player[playerid][FactionID], string);
    }
    else return SendClientMessage(playerid, COLOR_GREY, "You are not in a faction.");
    return 1;
}
Not sure what's causing the issue, but when you use the chat: http://i.imgur.com/C9NlC90.png


Re: Faction Chat Help - iSaint - 29.05.2015

Код:
CMD:faction(playerid, params[])
{
    if(GetPVarInt(playerid, "LoggedIn") == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, ADMIN);
    new string[128], message[100], fid = Player[playerid][FactionID];
    if(Player[playerid][FactionID] != 0)
    {
        if(sscanf(params, "s[100]", message)) return SendClientMessage(playerid, COLOR_GREY, "[Server Command]: /f[action] [message]");
        if(Player[playerid][Rank] == 1) rank = Faction[fid][F1Rank];
		else if(Player[playerid][Rank] == 2) rank = Faction[fid][F2Rank];
		else if(Player[playerid][Rank] == 3) rank = Faction[fid][F3Rank];
		else if(Player[playerid][Rank] == 4) rank = Faction[fid][F4Rank];
		else if(Player[playerid][Rank] == 5) rank = Faction[fid][F5Rank];
		else if(Player[playerid][Rank] == 6) rank = Faction[fid][F6Rank];
  		format(string, sizeof(string), "(( %s [%s] says: %s ))", GetName(playerid), rank, message);
		FactionChat(Player[playerid][FactionID], string);
    }
    else return SendClientMessage(playerid, COLOR_GREY, "You are not in a faction.");
Not sure if that'll work, but you can try it.


Re: Faction Chat Help - DTV - 29.05.2015

Quote:
Originally Posted by iSaint
Посмотреть сообщение
Код:
CMD:faction(playerid, params[])
{
    if(GetPVarInt(playerid, "LoggedIn") == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, ADMIN);
    new string[128], message[100], fid = Player[playerid][FactionID];
    if(Player[playerid][FactionID] != 0)
    {
        if(sscanf(params, "s[100]", message)) return SendClientMessage(playerid, COLOR_GREY, "[Server Command]: /f[action] [message]");
        if(Player[playerid][Rank] == 1) rank = Faction[fid][F1Rank];
		else if(Player[playerid][Rank] == 2) rank = Faction[fid][F2Rank];
		else if(Player[playerid][Rank] == 3) rank = Faction[fid][F3Rank];
		else if(Player[playerid][Rank] == 4) rank = Faction[fid][F4Rank];
		else if(Player[playerid][Rank] == 5) rank = Faction[fid][F5Rank];
		else if(Player[playerid][Rank] == 6) rank = Faction[fid][F6Rank];
  		format(string, sizeof(string), "(( %s [%s] says: %s ))", GetName(playerid), rank, message);
		FactionChat(Player[playerid][FactionID], string);
    }
    else return SendClientMessage(playerid, COLOR_GREY, "You are not in a faction.");
Not sure if that'll work, but you can try it.
Deleting 'rank' would cause more errors.


Re: Faction Chat Help - McGuiness - 29.05.2015

pawn Код:
stock FRank(playerid)
{
    new rank[32];
    if(PlayerInfo[playerid][FactionID] == 1)
    {
        if(Player[playerid][Rank] == 1) format(rank, sizeof(rank), "%s", Faction[fid][F1Rank]);
        else if(Player[playerid][Rank] == 2) format(rank, sizeof(rank), "%s", Faction[fid][F2Rank]);
        else if(Player[playerid][Rank] == 3) format(rank, sizeof(rank), "%s", Faction[fid][F3Rank]);
        else if(Player[playerid][Rank] == 4) format(rank, sizeof(rank), "%s", Faction[fid][F4Rank]);
        else if(Player[playerid][Rank] == 5) format(rank, sizeof(rank), "%s", Faction[fid][F5Rank]);
        else if(Player[playerid][Rank] == 6) format(rank, sizeof(rank), "%s", Faction[fid][F6Rank]);
    }
    return rank;
}

CMD:faction(playerid, params[])
{
    if(GetPVarInt(playerid, "LoggedIn") == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, ADMIN);
    new string[128], message[100], rank, fid = Player[playerid][FactionID];
    if(Player[playerid][FactionID] != 0)
    {
        if(sscanf(params, "s[100]", message)) return SendClientMessage(playerid, COLOR_GREY, "[Server Command]: /f[action] [message]");
        format(string, sizeof(string), "(( %s [%s] says: %s ))", GetName(playerid), FRank(playerid), message);
        FactionChat(Player[playerid][FactionID], string);
    }
    else return SendClientMessage(playerid, COLOR_GREY, "You are not in a faction.");
    return 1;
}
Try using this, I know its in a stock, but it may help ya! What it should do is check the players rank, then format the rank from the "Faction" info and then display it in your command just by added "FRank(playerid)"


Re: Faction Chat Help - DTV - 29.05.2015

Quote:
Originally Posted by McGuiness
Посмотреть сообщение
pawn Код:
stock FRank(playerid)
{
    new rank[32];
    if(PlayerInfo[playerid][FactionID] == 1)
    {
        if(Player[playerid][Rank] == 1) format(rank, sizeof(rank), "%s", Faction[fid][F1Rank]);
        else if(Player[playerid][Rank] == 2) format(rank, sizeof(rank), "%s", Faction[fid][F2Rank]);
        else if(Player[playerid][Rank] == 3) format(rank, sizeof(rank), "%s", Faction[fid][F3Rank]);
        else if(Player[playerid][Rank] == 4) format(rank, sizeof(rank), "%s", Faction[fid][F4Rank]);
        else if(Player[playerid][Rank] == 5) format(rank, sizeof(rank), "%s", Faction[fid][F5Rank]);
        else if(Player[playerid][Rank] == 6) format(rank, sizeof(rank), "%s", Faction[fid][F6Rank]);
    }
    return rank;
}

CMD:faction(playerid, params[])
{
    if(GetPVarInt(playerid, "LoggedIn") == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, ADMIN);
    new string[128], message[100], rank, fid = Player[playerid][FactionID];
    if(Player[playerid][FactionID] != 0)
    {
        if(sscanf(params, "s[100]", message)) return SendClientMessage(playerid, COLOR_GREY, "[Server Command]: /f[action] [message]");
        format(string, sizeof(string), "(( %s [%s] says: %s ))", GetName(playerid), FRank(playerid), message);
        FactionChat(Player[playerid][FactionID], string);
    }
    else return SendClientMessage(playerid, COLOR_GREY, "You are not in a faction.");
    return 1;
}
Try using this, I know its in a stock, but it may help ya! What it should do is check the players rank, then format the rank from the "Faction" info and then display it in your command just by added "FRank(playerid)"
I had to alter the code a little, but it worked regardless, thanks


Re: Faction Chat Help - McGuiness - 30.05.2015

Quote:
Originally Posted by DTV
Посмотреть сообщение
I had to alter the code a little, but it worked regardless, thanks
No problem just make sure that you create things into stocks or something first before asking as it may help!