SA-MP Forums Archive
[HELP] Chat - 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: [HELP] Chat (/showthread.php?tid=500905)



[SOLVED] Chat - ShinichiKudou - 15.03.2014

/g chat global chat command

pawn Код:
CMD:g(playerid,params[])
{
if(toggc[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "======== Use /toggc First! ========");
else if(toggc[playerid] == 1)
 {
    new rank[50],name[50],text[200],msg[250];
    if(sscanf(params,"s[200]",text)) return SendClientMessage(playerid,-1,"USAGE: /g [text]");
    GetPlayerName(playerid,name,sizeof(name));
    if(PlayerInfo[playerid][pAdmin] > 0)
    {
     if(PlayerInfo[playerid][pAdmin] == 1)
     {
     format(rank,sizeof(rank),"Moderator");
     }
     else if(PlayerInfo[playerid][pAdmin] == 2)
     {
     format(rank,sizeof(rank),"Junior Admin");
     }
     else if(PlayerInfo[playerid][pAdmin] == 3)
     {
     format(rank,sizeof(rank),"General Admin");
     }
     else if(PlayerInfo[playerid][pAdmin] == 4)
     {
     format(rank,sizeof(rank),"Senior Admin");
     }
     else if(PlayerInfo[playerid][pAdmin] == 1337)
     {
     format(rank,sizeof(rank),"Head Admin");
     }
     else if(PlayerInfo[playerid][pAdmin] == 1338)
     {
     format(rank,sizeof(rank),"Lead Head Admin");
     }
     else if(PlayerInfo[playerid][pAdmin] == 999997)
     {
     format(rank,sizeof(rank),"Executive Admin");
     }
     else if(PlayerInfo[playerid][pAdmin] == 999998)
     {
     format(rank,sizeof(rank),"Community Co-Director");
     }
     else if(PlayerInfo[playerid][pAdmin] == 999999)
     {
     format(rank,sizeof(rank),"Community Director");
     }
    }
    else if(PlayerInfo[playerid][pHelper] > 0)
    {
     if(PlayerInfo[playerid][pHelper] == 1)
     {
     format(rank,sizeof(rank),"Helper");
     }
     else if(PlayerInfo[playerid][pHelper] == 2)
     {
     format(rank,sizeof(rank),"Community Advisor");
     }
     else if(PlayerInfo[playerid][pHelper] == 3)
     {
     format(rank,sizeof(rank),"Senior Advisor");
     }
     else if(PlayerInfo[playerid][pHelper] == 4)
     {
     format(rank,sizeof(rank),"Chief Advisor");
     }
    }
    else if(PlayerInfo[playerid][pDonateRank] > 0)
    {
     if(PlayerInfo[playerid][pDonateRank] == 1)
     {
     format(rank,sizeof(rank),"Bronze VIP");
     }
     else if(PlayerInfo[playerid][pDonateRank] == 2)
     {
     format(rank,sizeof(rank),"Silver VIP");
     }
     else if(PlayerInfo[playerid][pDonateRank] == 3)
     {
     format(rank,sizeof(rank),"Gold VIP");
     }
     else if(PlayerInfo[playerid][pDonateRank] == 4)
     {
     format(rank,sizeof(rank),"Platinum VIP");
     }
     else if(PlayerInfo[playerid][pDonateRank] == 5)
     {
     format(rank,sizeof(rank),"VIP Moderator");
     }
    }
    else if(PlayerInfo[playerid][pAdmin] < 0 || PlayerInfo[playerid][pHelper] < 0 || PlayerInfo[playerid][pDonateRank] < 0)
     {
     format(rank,sizeof(rank),"Player");
     }
    format(msg,sizeof(msg),"(( %s %s: %s ))",rank,name,text);
    for(new i=0;i<=MAX_PLAYERS;i++)
    {
            SendClientMessage(i,COLOR_ORANGE,msg);
    }
 }
return 1;
}
/toggc global chat toggle
pawn Код:
CMD:toggc(playerid,params[])
{
    if(toggc[playerid] == 0)
    {
        SendClientMessage(playerid,-1,"You have enabled global chat!");
        toggc[playerid] = 1;
    }
  else if(toggc[playerid] == 1)
    {
        SendClientMessage(playerid,-1,"You have disabled global chat!");
        toggc[playerid] = 0;
    }
    return 1;
}
I have this cmd but i want the message to show up only if the toggle was on
can you please help me


Re: [HELP] Chat - BroZeus - 15.03.2014

what is the problem in this?
and i think u shoudl use this line
Код:
else if(PlayerInfo[playerid][pAdmin] == 0 || PlayerInfo[playerid][pHelper] == 0 || PlayerInfo[playerid][pDonateRank] == 0)



Re: [HELP] Chat - ShinichiKudou - 15.03.2014

I changed to that already quickly after the post
i just want the message to be sent to people with /toggc on


Re: [HELP] Chat - BroZeus - 15.03.2014

keep the toggc command as it is and use this--
pawn Код:
public OnPlayerText(playerid,text)
{
if(toggc[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "======== Use /toggc First! ========");
else if(toggc[playerid] == 1)
 {
    new rank[50],name[50],text[200],msg[250];
    if(sscanf(params,"s[200]",text)) return SendClientMessage(playerid,-1,"USAGE: /g [text]");
    GetPlayerName(playerid,name,sizeof(name));
    if(PlayerInfo[playerid][pAdmin] > 0)
    {
     if(PlayerInfo[playerid][pAdmin] == 1)
     {
     format(rank,sizeof(rank),"Moderator");
     }
     else if(PlayerInfo[playerid][pAdmin] == 2)
     {
     format(rank,sizeof(rank),"Junior Admin");
     }
     else if(PlayerInfo[playerid][pAdmin] == 3)
     {
     format(rank,sizeof(rank),"General Admin");
     }
     else if(PlayerInfo[playerid][pAdmin] == 4)
     {
     format(rank,sizeof(rank),"Senior Admin");
     }
     else if(PlayerInfo[playerid][pAdmin] == 1337)
     {
     format(rank,sizeof(rank),"Head Admin");
     }
     else if(PlayerInfo[playerid][pAdmin] == 1338)
     {
     format(rank,sizeof(rank),"Lead Head Admin");
     }
     else if(PlayerInfo[playerid][pAdmin] == 999997)
     {
     format(rank,sizeof(rank),"Executive Admin");
     }
     else if(PlayerInfo[playerid][pAdmin] == 999998)
     {
     format(rank,sizeof(rank),"Community Co-Director");
     }
     else if(PlayerInfo[playerid][pAdmin] == 999999)
     {
     format(rank,sizeof(rank),"Community Director");
     }
    }
    else if(PlayerInfo[playerid][pHelper] > 0)
    {
     if(PlayerInfo[playerid][pHelper] == 1)
     {
     format(rank,sizeof(rank),"Helper");
     }
     else if(PlayerInfo[playerid][pHelper] == 2)
     {
     format(rank,sizeof(rank),"Community Advisor");
     }
     else if(PlayerInfo[playerid][pHelper] == 3)
     {
     format(rank,sizeof(rank),"Senior Advisor");
     }
     else if(PlayerInfo[playerid][pHelper] == 4)
     {
     format(rank,sizeof(rank),"Chief Advisor");
     }
    }
    else if(PlayerInfo[playerid][pDonateRank] > 0)
    {
     if(PlayerInfo[playerid][pDonateRank] == 1)
     {
     format(rank,sizeof(rank),"Bronze VIP");
     }
     else if(PlayerInfo[playerid][pDonateRank] == 2)
     {
     format(rank,sizeof(rank),"Silver VIP");
     }
     else if(PlayerInfo[playerid][pDonateRank] == 3)
     {
     format(rank,sizeof(rank),"Gold VIP");
     }
     else if(PlayerInfo[playerid][pDonateRank] == 4)
     {
     format(rank,sizeof(rank),"Platinum VIP");
     }
     else if(PlayerInfo[playerid][pDonateRank] == 5)
     {
     format(rank,sizeof(rank),"VIP Moderator");
     }
    }
    else if(PlayerInfo[playerid][pAdmin] < 0 || PlayerInfo[playerid][pHelper] < 0 || PlayerInfo[playerid][pDonateRank] < 0)
     {
     format(rank,sizeof(rank),"Player");
     }
    format(msg,sizeof(msg),"(( %s %s: %s ))",rank,name,text);
   
   
            SendClientMessageToAll(COLOR_ORANGE,msg);
   
 }
return 1;}



Re: [HELP] Chat - ShinichiKudou - 15.03.2014

how about /g??


Re: [HELP] Chat - ShinichiKudou - 15.03.2014

bummp?


Re: [HELP] Chat - ShinichiKudou - 15.03.2014

bump


Re: [HELP] Chat - ShinichiKudou - 15.03.2014

bump


Re: [HELP] Chat - ShinichiKudou - 15.03.2014

any one help me? i really need that function because my chat gets flooded so i want toggc to stop recieving messages when its turned off


AW: [HELP] Chat - Macronix - 15.03.2014

pawn Код:
CMD:toggc(playerid,params[])
    {
        if(toggc[playerid] == 1)
        {
            SendClientMessage(playerid,-1,"You have disabled global chat!");
            toggc[playerid] = 0;
            return 1;
        }
       
        SendClientMessage(playerid,-1,"You have enabled global chat!");
        toggc[playerid] = 1;
        return 1;
    }