14.01.2012, 03:18
(
Последний раз редактировалось Rokzlive; 23.01.2012 в 23:27.
)
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
Can I set a default cb channel?
Yes! You set a default CB channel by editing the following line.
pawn Код:
#define DEFUALT_CB 1
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;
}