Problem with SendPlayerFormattedText
#1

Guys i have created a command for changing walkie talkie frequency so when you will join a channel if some one on that channel it will show him a message player has joined your channel it works perfect but when you left the channel i mean change your frequency to something else then i want to show the message to old frequency's members like player has left your channel here is my code and i don't know what is the problem its not showing left channel message to players

pawn Код:
CMD:wtc(playerid, params[])
{
    new giveplayerid, playername[25], string[256],msgtop;
    if (playeritems[playerid][ITEM_TYPE_WALKIETALKIE] == -1) return SendClientMessage2(playerid, COLOR_WHITE, "You do not own a walkie talkie.");
    if (playeritems[playerid][ITEM_TYPE_WALKIETALKIE] == 0) return SendClientMessage2(playerid, COLOR_RED, "Error: Your walkie talkie is switched off. You can turn it on using /wton");
    if (sscanf(params, "d", giveplayerid)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /wtc [channel]");
    if (giveplayerid < 0 || giveplayerid > cellmax) return SendClientMessage2(playerid, COLOR_RED, "Invalid channel! Select from 0 - 2147483647.");
    GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
    SetPVarInt(playerid, "wtfrequency", giveplayerid);
    dini_IntSet(AddDirFile(dir_userfiles, playername), "wtfreq", giveplayerid);
    format(string, sizeof(string), "[WT] You have joined channel %d.", giveplayerid);
    SendClientMessage2(playerid, COLOR_PURPLE, string);
    for(new i; i<PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && i!=playerid)
        {
            if(GetPVarInt(playerid, "wtfrequency") == GetPVarInt(i, "wtfrequency") && playeritems[playerid][ITEM_TYPE_WALKIETALKIE]==1 && playeritems[i][ITEM_TYPE_WALKIETALKIE])
            {
            SendPlayerFormattedText(i, COLOR_PURPLE, "[WT] %s has joined your channel.", playername, "");
            }
            else if(GetPVarInt(playerid, "wtfrequency") != GetPVarInt(i, "wtfrequency") && playeritems[playerid][ITEM_TYPE_WALKIETALKIE]==1  && playeritems[i][ITEM_TYPE_WALKIETALKIE]==1)
            {
                SendPlayerFormattedText(i, COLOR_PURPLE, "[WT] %s has left your channel.", playername, "");
            }
            return 1;
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)