Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //==============================================================================
- #include <a_samp>
- #include <YSI\y_commands>
- //==============================================================================
- #define MyTime(%0,%1,%2) (((%0)*3600+(%1)*60+(%2))*1000)
- //==============================================================================
- enum CBInfo
- {
- pCB,
- pChannel,
- pStatus,
- pLevel,
- pOwner,
- pCBChannel
- }
- new RadioInfo[MAX_PLAYERS][CBInfo];
- //==============================================================================
- public OnFilterScriptInit()
- {
- print("\t\t\t-> Scripter : Glint");
- print("\t\t\t-> Script Name : CBRadio");
- print("\t\t\t-> Script Version : 0.1");
- return 1;
- }
- //==============================================================================
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- //==============================================================================
- COMMAND:joinchannel(playerid, params[])
- {
- if(RadioInfo[playerid][pCB] == 0) return SendClientMessage(playerid, -1, "{FF0000}>>{FFFFFF} You {FF0000}Don't Have{FFFFFF} A Radio You Need To Buy One First {FF0000}(/cbhelp)");
- if(RadioInfo[playerid][pStatus] == 0) return SendClientMessage(playerid, -1, "{FF0000}>>{FFFFFF} Your Radio Is Turned Off Turn It On Using {FF0000}(/setcb)");
- if(isnull(params)) return SendClientMessage(playerid, -1, "{1A80E6}USAGE: {FFFFFF}/joinchannel [1 - 1000]");
- if(strval(params) < 1 || strval(params) > 1000) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}The Channel Must Be Between {FF0000}(1 - 1000)");
- RadioInfo[playerid][pChannel] = strval(params);
- new Str[128], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, sizeof(pName));
- format(Str, sizeof(Str), "{FF0000}>>{FFFFFF} You Have Joined Channel {FF0000}(%s)", params);
- SendClientMessage(playerid, -1, Str);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(RadioInfo[i][pChannel] == RadioInfo[playerid][pChannel])
- {
- format(Str, sizeof(Str), "{FF0000}>>{C0C0C0} %s Has Joined The Channel", pName);
- SendClientMessage(i, -1, Str);
- }
- }
- return 1;
- }
- //==============================================================================
- COMMAND:buycb(playerid, params[])
- {
- if(RadioInfo[playerid][pCB] == 1) return SendClientMessage(playerid, -1, "{FF0000}>>{FFFFFF} You {00FF00}Already Have{FFFFFF} A Radio");
- RadioInfo[playerid][pCB] = 1;
- SendClientMessage(playerid, -1, "{FF0000}>>{FFFFFF} You Have {00FF00}Bought{FFFFFF} A Citizens Band (CB) Radio For Help Use {FF0000}(/cbhelp)");
- return 1;
- }
- //==============================================================================
- COMMAND:setcb(playerid, params[])
- {
- if(isnull(params)) return SendClientMessage(playerid, -1, "{1A80E6}USAGE: {FFFFFF}/setcb [0 = Off] [1 = On]");
- if(strval(params) == 1)
- {
- if(RadioInfo[playerid][pStatus] == 1)
- {
- SendClientMessage(playerid, -1, "{FF0000}>>{FFFFFF} Your Radio Is Already {00FF00}On");
- }
- else
- {
- SendClientMessage(playerid, -1, "{FF0000}>>{FFFFFF} You Have {00FF00}Successfully{FFFFFF} Turned {00FF00}On{FFFFFF} Your Radio");
- RadioInfo[playerid][pStatus] = 1;
- }
- }
- else if(strval(params) == 0)
- {
- if(RadioInfo[playerid][pStatus] == 0)
- {
- SendClientMessage(playerid, -1, "{FF0000}>>{FFFFFF} Your Radio Is Already {FF0000}Off");
- }
- else
- {
- SendClientMessage(playerid, -1, "{FF0000}>>{FFFFFF} You Have {00FF00}Successfully{FFFFFF} Turned {FF0000}Off{FFFFFF} Your Radio");
- RadioInfo[playerid][pStatus] = 0;
- }
- }
- return 1;
- }
- //==============================================================================
- COMMAND:cb(playerid, params[])
- {
- if(RadioInfo[playerid][pCB] == 0) return SendClientMessage(playerid, -1, "{FF0000}>>{FFFFFF} You {FF0000}Don't Have{FFFFFF} A Radio You Need To Buy One First {FF0000}(/cbhelp)");
- if(RadioInfo[playerid][pStatus] == 0) return SendClientMessage(playerid, -1, "{FF0000}>>{FFFFFF} Your Radio Is Turned Off Turn It On Using {FF0000}(/setcb)");
- if(isnull(params)) return SendClientMessage(playerid, -1, "{1A80E6}USAGE: {FFFFFF}/cb [Your Message]");
- new pName[MAX_PLAYER_NAME], Str[200];
- GetPlayerName(playerid, pName, sizeof(pName));
- format(Str, sizeof(Str), "{00FF00}[CB]{FF8000} %s: {FFFFFF}%s", pName, params);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(!IsPlayerConnected(i)) continue;
- if(RadioInfo[i][pChannel] == RadioInfo[playerid][pChannel])
- {
- SendClientMessage(i, -1, Str);
- }
- }
- return 1;
- }
- //==============================================================================
- COMMAND:cbalert(playerid, params[])
- {
- if(RadioInfo[playerid][pCB] == 0) return SendClientMessage(playerid, -1, "{FF0000}>>{FFFFFF} You {FF0000}Don't Have{FFFFFF} A Radio You Need To Buy One First {FF0000}(/cbhelp)");
- if(RadioInfo[playerid][pStatus] == 0) return SendClientMessage(playerid, -1, "{FF0000}>>{FFFFFF} Your Radio Is Turned Off Turn It On Using {FF0000}(/setcb)");
- if(isnull(params)) return SendClientMessage(playerid, -1, "{1A80E6}USAGE: {FFFFFF}/cbalert [Your Message]");
- new pName[MAX_PLAYER_NAME], Str[128];
- GetPlayerName(playerid, pName, sizeof(pName));
- format(Str, sizeof(Str), "{00FF00}[CB ALERT]{FF8000} %s", pName);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(!IsPlayerConnected(i)) continue;
- if(RadioInfo[i][pChannel] == RadioInfo[playerid][pChannel])
- {
- GameTextForPlayer(i, params, MyTime(0, 0, 5), 6);
- SendClientMessage(i, -1, Str);
- }
- }
- return 1;
- }
- //==============================================================================
- COMMAND:cbhelp(playerid, params[])
- {
- new Str[1500];
- strcat(Str, "\t\t{FF0000} - Citizens Band Radio System (CB) - \n{FFFFFF}A CB Radio Is A Communication Tool Used To Communicate In A Business Or \n{FFFFFF}Personally It Has A Max Of 1000 Channels You Can Choose From And Tell Your\n{FFFFFF}Gang For Example To Join That Specific Channel And You Can Talk Togeather\n\n", sizeof(Str));
- strcat(Str, "{FFFF00}Commands : \n{FF8000}\t\t- /joinchannel (To Join A Channel)\n\t\t{FF8000}- /buycb (To Buy A CB)\n\t\t{FF8000}- /setcb (To Turn Your CB On / Off", sizeof(Str));
- strcat(Str, "\n\t\t{FF8000}- /cb (To Talk Through The CB\n\t\t{FF8000}- /cbalert (To Send An Alert To All Users In The Channel\n\n{FFFF00}Credits :\n\t\t{FF8000}- Glint <3 For Creating This System\n\t\t{FF8000}- Y_Less For The YSI Library\n\n\n", sizeof(Str));
- ShowPlayerDialog(playerid, 1212, DIALOG_STYLE_MSGBOX, "Citizens Band Radio", Str, "Close", "");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement