Error with faction OOC talk
#1

Okay, the thing is, when someone uses /f and then says something, first it comes up with

%s says: ...

Then afterwards at the same second it comes up with

%s says: ... "message"

Anyone can explain this?

pawn Код:
COMMAND:factiontalk(playerid, params[]) {
    new message[128];
    if(PlayerInfo[playerid][pFaction] == 0) return SendClientMessage(playerid, COLOR_GREY, "You are not in any faction.");
    if(sscanf(params, "s[128]", message)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /factiontalk [message]");
    if(GetPVarInt(playerid, "Muted") == 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: You are currently muted.");
    if(FactionInfo[PlayerInfo[playerid][pFaction]][fChat] != 0) return SendClientMessage(playerid, COLOR_GREY, "The faction chat is currently disabled.");
    if(GetPVarInt(playerid, "ToggleFC") != 0) return SendClientMessage(playerid, COLOR_GREY, "You currently do not receive messages of the faction chat, use /togf before sending messages.");
    new len = strlen(message);
    if(len + MAX_PLAYER_NAME + 34 > 128) {
        new buffer[128];
        strmid(buffer, message, 0, 128 - MAX_PLAYER_NAME - 34 - 4);
        format(buffer, sizeof(buffer), "(( %s %s: %s ... ))", GetFactionRank(playerid), GetNameWithSpace(playerid), buffer);
        strdel(message, 0, 128 - MAX_PLAYER_NAME - 34 - 4);
        format(message, sizeof(message), "(( %s %s: ... %s ))", GetFactionRank(playerid), GetNameWithSpace(playerid), message);
        foreach(new i : Player) {
            if(PlayerInfo[i][pFaction] == PlayerInfo[playerid][pFaction] && GetPVarInt(i, "ToggleFC") == 0) {
                SendClientMessage(i, COLOR_FACTIONGREEN, buffer);
                SendClientMessage(i, COLOR_FACTIONGREEN, message);
            }
        }
    } else {
        format(message, sizeof(message), "(( %s %s: %s ))", GetFactionRank(playerid), GetNameWithSpace(playerid), message);
        foreach(new i : Player) {
            if(PlayerInfo[i][pFaction] == PlayerInfo[playerid][pFaction] && GetPVarInt(i, "ToggleFC") == 0) {
                SendClientMessage(i, COLOR_FACTIONGREEN, message);
            }
        }
    }

    return 1;
}
Reply


Messages In This Thread
Error with faction OOC talk - by EmilLykke - 20.08.2014, 20:48

Forum Jump:


Users browsing this thread: 1 Guest(s)