Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:placeboombox(playerid, params[])
- {
- if(PlayerInfo[playerid][pBoombox] == 1 || PlayerInfo[playerid][pAdmin] >= 4)
- {
- if(GetPVarInt(playerid, "IsInArena") >= 0) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this while being in an arena!");
- if(WatchingTV[playerid] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can not do this while watching TV!");
- if(GetPVarInt(playerid, "Injured") == 1 || PlayerInfo[playerid][pHospital] == 1 || IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now.");
- if(GetPVarType(playerid, "pBoomBox")) return SendClientMessageEx(playerid, COLOR_WHITE, "You already have a boombox out, use /destroyboombox.");
- foreach(new i: Player)
- {
- if(GetPVarType(i, "pBoomBox"))
- {
- if(IsPlayerInRangeOfPoint(playerid, 30.0, GetPVarFloat(i, "pBoomBoxX"), GetPVarFloat(i, "pBoomBoxY"), GetPVarFloat(i, "pBoomBoxZ")))
- {
- SendClientMessage(playerid, COLOR_WHITE, "You are in range of another boombox, you can't place one here!");
- return 1;
- }
- }
- }
- new string[128];
- format(string, sizeof(string), "%s has placed a boombox!", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
- new Float:x, Float:y, Float:z, Float:a;
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, a);
- ApplyAnimation(playerid,"BOMBER","BOM_Plant_Crouch_In", 4.0, 0, 0, 0, 0, 0, 1);
- x += (2 * floatsin(-a, degrees));
- y += (2 * floatcos(-a, degrees));
- z -= 1.0;
- SetPVarInt(playerid, "pBoomBox", CreateDynamicObject(2226, x, y, z, 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
- SetPVarFloat(playerid, "pBoomBoxX", x); SetPVarFloat(playerid, "pBoomBoxY", y); SetPVarFloat(playerid, "pBoomBoxZ", z);
- format(string, sizeof(string), "%s's boombox\n{FF0000}/setboombox {FFFF00}or\n{FF0000}/destroyboombox", GetPlayerNameEx(playerid));
- SetPVarInt(playerid, "pBoomBoxLabel", _:CreateDynamic3DTextLabel(string, COLOR_YELLOW, x, y, z+0.6, 5.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
- SetPVarInt(playerid, "pBoomBoxArea", CreateDynamicSphere(x, y, z, 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)));
- SetPVarInt(playerid, "pBoomBoxInt", GetPlayerInterior(playerid));
- SetPVarInt(playerid, "pBoomBoxVW", GetPlayerVirtualWorld(playerid));
- }
- else
- {
- SendClientMessageEx(playerid, COLOR_GRAD1, "You don't have a boom box! Buy from one a administrator/forums.");
- }
- return 1;
- }
- CMD:destroyboombox(playerid, params[])
- {
- if(GetPVarType(playerid, "pBoomBox"))
- {
- DestroyDynamicObject(GetPVarInt(playerid, "pBoomBox"));
- DestroyDynamic3DTextLabel(Text3D:GetPVarInt(playerid, "pBoomBoxLabel"));
- DeletePVar(playerid, "pBoomBox"); DeletePVar(playerid, "pBoomBoxStation"); DeletePVar(playerid, "pBoomBoxLabel");
- DeletePVar(playerid, "pBoomBoxX"); DeletePVar(playerid, "pBoomBoxY"); DeletePVar(playerid, "pBoomBoxZ");
- if(GetPVarType(playerid, "pBoomBoxArea"))
- {
- new string[128];
- format(string, sizeof(string), "* %s has destroyed the boombox.", GetPlayerNameEx(playerid));
- foreach(new i: Player)
- {
- if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pBoomBoxArea")))
- {
- StopAudioStreamForPlayer(i);
- SendClientMessage(i, COLOR_PURPLE, string);
- }
- }
- DeletePVar(playerid, "pBoomBoxArea");
- }
- SendClientMessage(playerid, COLOR_WHITE, "You've destroyed your boombox!");
- }
- else
- {
- foreach(new i: Player)
- {
- if(GetPVarType(i, "pBoomBox"))
- {
- if(GetPVarInt(i, "pBoomBoxVW") == GetPlayerVirtualWorld(playerid) && GetPVarInt(i, "pBoomBoxInt") == GetPlayerInterior(playerid) && IsPlayerInRangeOfPoint(playerid, 5.0, GetPVarFloat(i, "pBoomBoxX"), GetPVarFloat(i, "pBoomBoxY"), GetPVarFloat(i, "pBoomBoxZ")))
- {
- DestroyDynamicObject(GetPVarInt(i, "pBoomBox"));
- DestroyDynamic3DTextLabel(Text3D:GetPVarInt(i, "pBoomBoxLabel"));
- DeletePVar(i, "pBoomBox");
- DeletePVar(i, "pBoomBoxStation");
- DeletePVar(i, "pBoomBoxLabel");
- DeletePVar(i, "pBoomBoxX");
- DeletePVar(i, "pBoomBoxY");
- DeletePVar(i, "pBoomBoxZ");
- DeletePVar(i, "pBoomBoxInt");
- DeletePVar(i, "pBoomBoxVW");
- new string[128];
- if(GetPVarType(i, "pBoomBoxArea"))
- {
- format(string, sizeof(string), "* %s has destroyed the boombox.", GetPlayerNameEx(playerid));
- foreach(new pi: Player)
- {
- if(IsPlayerInDynamicArea(pi, GetPVarInt(i, "pBoomBoxArea")))
- {
- StopAudioStreamForPlayer(pi);
- SendClientMessage(pi, COLOR_PURPLE, string);
- }
- }
- DeletePVar(i, "pBoomBoxArea");
- }
- format(string, sizeof(string), "%s has destroyed your boombox!", GetPlayerNameEx(playerid));
- SendClientMessage(i, COLOR_WHITE, string);
- return 1;
- }
- }
- }
- SendClientMessage(playerid, COLOR_WHITE, "You don't have a boombox or you are not near one to destroy.");
- }
- return 1;
- }
- CMD:setboombox(playerid, params[])
- {
- if(GetPVarType(playerid, "pBoomBox"))
- {
- ShowPlayerDialog(playerid,SETSTATION,DIALOG_STYLE_LIST,"Radio Menu","HOT 108 JAMZ\n108.FM THE HITLIST\nHIP HOP STOP\nTurn radio off","Select", "Close");
- }
- else
- {
- SendClientMessage(playerid, COLOR_GRAD2, "You don't have a boombox out!");
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment