Help with join messages.
#1

This is on OnPlayerConnect.
pawn Код:
foreach(Player, i)
    {
        if(JoinMessages[i])
        new country[MAX_COUNTRY_NAME]; //, gmt
        new string[256];
        GetPlayerName(playerid, name, sizeof(name));
        country = GetPlayerCountryName(playerid);
        //  gmt = GetPlayerGMT(playerid);
        format(string, sizeof(string), "%s has joined the server from %s", name, country);
        SendClientMessageToAll(0xFFCFCFAA, string);
    }
Hello, i'm trying to make the above message work only when someone has their join messages on, with /tog join messages,
there currently is no stock of joinmessages just a:
pawn Код:
new JoinMessages[MAX_PLAYERS];
and ofc the command.

pawn Код:
CMD:tog(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(sscanf(params, "s[16]", params))
    {
        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /tog [option]");
        SendClientMessage(playerid, COLOR_GREY, "OPTIONS: fuel | speedo | phone | vip | join | oldskool | loyal");
        if(PlayerInfo[playerid][pAdmin]) SendClientMessage(playerid, COLOR_GREY, "OPTIONS: adminooc | adminnewbie | betachat");
        return 1;
    }
    if(!strcmp(params, "speedo", true))
    {
        if(!PlayerInfo[playerid][pSpeedo]) return SendClientMessage(playerid, COLOR_GREY, "You don't have a speedometer.");
        if(!Speedo[playerid])
        {
            Speedo[playerid] = 1;
            format(string, sizeof(string), "You have turned your speedometer {33AA33}on{33CCFF}.");
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else
        {
            Speedo[playerid] = 0;
            format(string, sizeof(string), "You have turned your speedometer {FF9900}off{33CCFF}.");
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        return 1;
    }
    else if(!strcmp(params, "oldskool", true))
    {
        if(PlayerInfo[playerid][pHours] < 248) return SendClientMessage(playerid, COLOR_GREY, "You need to have at least 248 respect points to use this feature.");
        if(!PlayerInfo[playerid][pOldskool])
        {
            PlayerInfo[playerid][pOldskool] = 1;
            format(string, sizeof(string), "You have toggled your Oldskool tag {33AA33}on{33CCFF}.");
            SendClientMessage(playerid, COLOR_WHITE, string);
        }
        else
        {
            PlayerInfo[playerid][pOldskool] = 0;
            format(string, sizeof(string), "You have toggled your Oldskool tag {FF9900}off{33CCFF}.");
            SendClientMessage(playerid, COLOR_WHITE, string);
        }
        return 1;
    }
    else if(!strcmp(params, "loyal", true))
    {
        if(PlayerInfo[playerid][pLoyal] && PlayerInfo[playerid][pLevel] < 5) return SendClientMessage(playerid, COLOR_GREY, "You are not a Loyal player.");
        if(!PlayerInfo[playerid][pLoyalTag])
        {
            PlayerInfo[playerid][pLoyalTag] = 1;
            format(string, sizeof(string), "You have toggled your Loyal tag {33AA33}on{33CCFF}.");
            SendClientMessage(playerid, COLOR_WHITE, string);
        }
        else
        {
            PlayerInfo[playerid][pLoyalTag] = 0;
            format(string, sizeof(string), "You have toggled your Loyal tag {FF9900}off{33CCFF}.");
            SendClientMessage(playerid, COLOR_WHITE, string);
        }
        return 1;
    }
    else if(!strcmp(params, "fuel", true))
    {
        if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You are not driving a vehicle.");
        if(!fMeter[playerid])
        {
            fMeter[playerid] = 1;
            format(string, sizeof(string), "You have turned your fuel information {33AA33}on{33CCFF}.");
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else
        {
            fMeter[playerid] = 0;
            format(string, sizeof(string), "You have turned your fuel information {FF9900}off{33CCFF}.");
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        return 1;
    }
    else if(!strcmp(params, "phone", true))
    {
        if(!PhoneOff[playerid])
        {
            format(string, sizeof(string), "* %s turns their phone off.", RPN(playerid));
            SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
            PhoneOff[playerid] = 1;
            SendClientMessage(playerid, COLOR_WHITE, " You have turned your phone {FF9900}off{FFFFFF}.");
        }
        else
        {
            format(string, sizeof(string), "* %s turns their phone on.", RPN(playerid));
            SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
            PhoneOff[playerid] = 0;
            SendClientMessage(playerid, COLOR_WHITE, " You have turned your phone {33AA33}on{FFFFFF}.");
        }
        return 1;
    }
    else if(!strcmp(params, "vip", true))
    {
        if(!VIPOff[playerid])
        {
            VIPOff[playerid] = 1;
            SendClientMessage(playerid, COLOR_WHITE, " You have toggled VIP chat {FF9900}off{FFFFFF}.");
        }
        else
        {
            VIPOff[playerid] = 0;
            SendClientMessage(playerid, COLOR_WHITE, " You have toggled VIP chat {33AA33}on{FFFFFF}.");
        }
        return 1;
    }
    else if(!strcmp(params, "join", true))
    {
        if(!JoinMessages[playerid])
        {
            JoinMessages[playerid] = 1;
            SendClientMessage(playerid, COLOR_WHITE, " You have toggled Join Messages {33AA33}on{FFFFFF}.");
        }
        else
        {
            JoinMessages[playerid] = 0;
            SendClientMessage(playerid, COLOR_WHITE, " You have toggled Join Messages {FF9900}off{FFFFFF}.");
        }
        return 1;
    }
    else if(!strcmp(params, "betachat", true))
    {
        if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
        if(PlayerInfo[playerid][pTester])
        {
            PlayerInfo[playerid][pTester] = 0;
            SendClientMessage(playerid, COLOR_WHITE, " You have toggled Beta Testers chat {FF9900}off{FFFFFF}.");
        }
        else
        {
            PlayerInfo[playerid][pTester] = 1;
            SendClientMessage(playerid, COLOR_WHITE, " You have toggled Beta Testers chat {33AA33}on{FFFFFF}.");
        }
        return 1;
    }
    else if(!strcmp(params, "adminooc", true))
    {
        if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
        if(!OOCStatus)
        {
            OOCStatus = 1;
            format(string, sizeof(string), "AdmCmd: %s has {33AA33}enabled {FF6347}the global OOC chat for everybody.", RPN(playerid));
            SendClientMessageToAll(COLOR_LIGHTRED, string);
        }
        else
        {
            OOCStatus = 0;
            format(string, sizeof(string), "AdmCmd: %s has {FF9900}disabled {FF6347}the global OOC chat for everybody.", RPN(playerid));
            SendClientMessageToAll(COLOR_LIGHTRED, string);
        }
    }
    else if(!strcmp(params, "adminnewbie", true))
    {
        if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
        if(!NewbieStatus)
        {
            NewbieStatus = 1;
            format(string, sizeof(string), "AdmCmd: %s has {33AA33}enabled {FF6347}the newbie chat for everybody.", RPN(playerid));
            SendClientMessageToAll(COLOR_LIGHTRED, string);
        }
        else
        {
            NewbieStatus = 0;
            format(string, sizeof(string), "AdmCmd: %s has {FF9900}disabled {FF6347}the newbie chat for everybody.", RPN(playerid));
            SendClientMessageToAll(COLOR_LIGHTRED, string);
        }
    }
    return 1;
}
Anyone here able to help me?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)