[FilterScript] Easy CB Light ~ Rokzlive
#1

Easy CB Light V.2
What is it?
Easy CB is a simple CB channel which allows players to talk in certain channels!

How does it work?
It fetches a players color and cb channel, then sends a message, with the players color (like a normal message) to all the other plays on the same CB channel as the player talking.

Can I add more channels?
Yes, you can add more channels by simply editing two defines.
pawn Код:
#define MINIMUM_CB 1
#define MAXIMUM_CB 10
You set MINIMUM_CB to the minimum cb channel you want to allow users in, and MAXIMUM_CB to the maximum cb channel you want to allow users in.

Can I set a default cb channel?
Yes! You set a default CB channel by editing the following line.
pawn Код:
#define DEFUALT_CB 1
Please note, this value can be out of the minimum/maximum range, but once a user switched out of it, they cant get back in.

How do i change my cb ingame?
Simply use the command /cb [id]

What includes/plugins do i need?
To use this, you need the ZCMD include and the SSCANF include and plugin.

Can i remove the credits?
Absolutely not! However, all credits are in script, none show in game, so no one will now your using this script except you!

Does it work?
Ive not personally tested this script, so im unsure. If it does not, please tell me and I will fix it ASAP!

Will there be updates?
Yes, i will update it and add more features!

What came in the v.2 update?
Player messages sent in the default cb will now be processed normally and sent to everyone on the server no matter what cb they are in. If you are in a cb other than the default, messages will be sent to just that cb channel.
Now when you switch into a cb, it will tell you what players are in that channel already.

Where can i get it?
Copy and paste the code below, then save and compile it and your filterscripts folder. Once you do that, include it in your server.cfg!
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#define MINIMUM_CB 1
#define MAXIMUM_CB 10
#define DEFUALT_CB 1
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_GREY 0xAFAFAFAA
forward SendClientMessageToCB(playerid,cbid,text[]);
enum pCbinfo
{
    cb
}
new pCb[MAX_PLAYERS][pCbinfo];
new String[500];
public OnFilterScriptInit()
{
    print("-------------------");
    print("Easy CB by Rokzlive");
    print("-------------------");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}
public OnPlayerConnect(playerid)
{
    pCb[playerid][cb] = DEFUALT_CB;
    return 1;
}
public OnPlayerText(playerid,text[])
{
    if(pCb[playerid][cb] == DEFUALT_CB) return 1;
    else SendClientMessageToCB(playerid,pCb[playerid][cb],text);
    return 0;
}
public SendClientMessageToCB(playerid,cbid,text[])
{
    format(String,sizeof(String),"%s(%i){FFFFFF}[CB:%i]: %s", GetName(playerid), playerid, GetPlayerCB(playerid), text);
    for(new i; i<= MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerCB(i)==cbid)
            {
                SendClientMessage(i,GetPlayerColor(playerid),String);
            }
        }
    }
    return 1;
}
stock  GetPlayerCB(playerid)
{
     return pCb[playerid][cb];
}
stock  SwitchCB(playerid, cbid)
{
    pCb[playerid][cb] = cbid;
    format(String,sizeof(String),"%s has switched their CB channel to %i!",GetName(playerid), cbid);
    SendClientMessageToAll(COLOR_YELLOW,String);
    format(String,sizeof(String),"Players currently in this CB channel:");
    new string1[40];
    for(new i; i<= MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(pCb[i][cb] == cbid)
            {
                format(string1,sizeof(string1)," %s(%d)",GetName(i),i);
                strcat(String,string1);
            }
        }
    }
    SendClientMessage(playerid,COLOR_GREY,String);
}
stock GetName(playerid)
{
    new name[24];
    GetPlayerName(playerid,name,sizeof(name));
    return name;
}
CMD:cb(playerid, params[])
{
    new id;
    format(String,sizeof(String),"Usage: /cb [id %d - %d]", MINIMUM_CB, MAXIMUM_CB);
    if(sscanf(params,"i",id))return SendClientMessage(playerid,-1,String);
    if(id < MINIMUM_CB || id > MAXIMUM_CB)return SendClientMessage(playerid,-1,String);
    SwitchCB(playerid,id);
    return 1;
}
Reply
#2

Not bad.
Yay FIRST POST
xD
Reply
#3

Good Job

+1Rep.
Reply
#4

really nice.
Reply
#5

Thankyou for all the positive feedback, being as it took me 2 minutes to make xD
Reply
#6

Didn't work for me. i type /cb 1 and it says "Unknown command". i use linux btw.
Reply
#7

Quote:
Originally Posted by flrp
Посмотреть сообщение
Didn't work for me. i type /cb 1 and it says "Unknown command". i use linux btw.
Are you using zcmd?
Reply
#8

Quote:
Originally Posted by Rokzlive
Посмотреть сообщение
Are you using zcmd?
yes i am.
Reply
#9

Really nice, but i have a suggestion, if the player are talking for the Custom CB, that the message of [CB:1] will not appear.
Reply
#10

Nikk, ill change it to where it wont show the number when the player is on the default cb, but for all others numbers will show.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)