Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pBoomBox,
- ////////////////////////////////////////////////////RADIO SYSTEM(BOOMBOX)/////////////////////////////////////////////
- CMD:rhelp(playerid, params[])
- {
- if(UlogovanProvera[playerid] == 0) return SCM(playerid,-1," "CRVENA2"Moras se ulogovati da bi koristio ovu komandu!");
- if(PlayerInfo[playerid][pBoomBox] == 0) return SCM(playerid, -1, ""CRVENA2"SERVER: Nemate Radio!");
- SendClientMessage(playerid, COLOR_RED, ""CRVENA2"Radio Komande: /postaviradio /pokupiradio /podesiradio");
- return 1;
- }
- CMD:postaviradio(playerid, params[])
- {
- if(PlayerInfo[playerid][pBoomBox] == 0) return SCM(playerid, -1, ""CRVENA2"SERVER: Nemate Radio!");
- new string[128], Float:BBCoord[4], pName[MAX_PLAYERS];
- GetPlayerPos(playerid, BBCoord[0], BBCoord[1], BBCoord[2]);
- GetPlayerFacingAngle(playerid, BBCoord[3]);
- SetPVarFloat(playerid, "BBX", BBCoord[0]);
- SetPVarFloat(playerid, "BBY", BBCoord[1]);
- SetPVarFloat(playerid, "BBZ", BBCoord[2]);
- GetPlayerName(playerid, pName, sizeof(pName));
- BBCoord[0] += (2 * floatsin(-BBCoord[3], degrees));
- BBCoord[1] += (2 * floatcos(-BBCoord[3], degrees));
- BBCoord[2] -= 1.0;
- //if(Boombox[playerid] == 0) return SCM(playerid, COLOR_WHITE, "You don't have a Boombox - Ask a Admin for one"); // Part of Variable
- if(GetPVarInt(playerid, "PlacedBB")) return SCM(playerid, -1, "Vec ste postavili radio- /pokupiradio");
- foreach(Player, i)
- {
- if(GetPVarType(i, "PlacedBB"))
- {
- if(IsPlayerInRangeOfPoint(playerid, 30.0, GetPVarFloat(i, "BBX"), GetPVarFloat(i, "BBY"), GetPVarFloat(i, "BBZ")))
- {
- SendClientMessage(playerid, COLOR_WHITE, "Neko je vec postavio radio u ovoj blizini");
- return 1;
- }
- }
- }
- new string2[128];
- format(string2, sizeof(string2), "%s postavlja radio na zemlju. ", pName);
- SendNearbyMessage(playerid, 15, string2, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
- SetPVarInt(playerid, "PlacedBB", CreateDynamicObject(2226, BBCoord[0], BBCoord[1], BBCoord[2], 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
- SetPVarInt(playerid, "BBLabel", _:CreateDynamic3DTextLabel(string, -1, BBCoord[0], BBCoord[1], BBCoord[2]+0.6, 5, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
- SetPVarInt(playerid, "BBArea", CreateDynamicSphere(BBCoord[0], BBCoord[1], BBCoord[2], 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)));
- SetPVarInt(playerid, "BBInt", GetPlayerInterior(playerid));
- SetPVarInt(playerid, "BBVW", GetPlayerVirtualWorld(playerid));
- ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
- ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
- return 1;
- }
- CMD:podesiradio(playerid, params[])
- {
- if(PlayerInfo[playerid][pBoomBox] == 0) return SCM(playerid, -1, ""CRVENA2"SERVER: Nemate Radio!");
- if(GetPVarType(playerid, "PlacedBB"))
- {
- if(IsPlayerInRangeOfPoint(playerid, 3.0, GetPVarFloat(playerid, "BBX"), GetPVarFloat(playerid, "BBY"), GetPVarFloat(playerid, "BBZ")))
- {
- ShowPlayerDialog(playerid,DIALOG_BOOMBOX,DIALOG_STYLE_LIST,"Lista Stanica","Jazz\nPop\nRap\nR&B and Urban\nRock\nCountry\nEnter URL\nTurn Off Boombox","Select", "Cancel");
- }
- else
- {
- return SendClientMessage(playerid, -1, "Niste u blizini radia!");
- }
- }
- else
- {
- SendClientMessage(playerid, -1, " Nemate postavljen radio na zemlji!");
- }
- return 1;
- }
- CMD:pokupiradio(playerid, params [])
- {
- if(PlayerInfo[playerid][pBoomBox] == 0) return SCM(playerid, -1, ""CRVENA2"SERVER: Nemate Radio!");
- if(!GetPVarInt(playerid, "PlacedBB"))
- {
- SendClientMessage(playerid, -1, "Niste postavili radio!");
- }
- if(IsPlayerInRangeOfPoint(playerid, 3.0, GetPVarFloat(playerid, "BBX"), GetPVarFloat(playerid, "BBY"), GetPVarFloat(playerid, "BBZ")))
- {
- PickUpBoombox(playerid);
- SendClientMessage(playerid, -1, "Pokupili ste radio sa zemlje.");
- }
- return 1;
- }
- // MARKET KUPOVINA
- case 10:
- {
- if(PlayerInfo[playerid][pBoomBox] == 1) return SCM(playerid,-1, ""CRVENA" "BELA"Vec imate radio.");
- if(PlayerInfo[playerid][pNovacDzep] < 500) return SCM(playerid,-1, ""CRVENA" "BELA"Nemate dovoljno novca, potrebno vam je 500$ za radio.");
- g_NovacMinus(playerid,500);
- FirmaNovac(UsaoFirma[playerid],500);
- PlayerInfo[playerid][pBoomBox] = 1;
- SCM(playerid,-1,""BELA"Kupili ste radio (/rhelp)!");
- SavePlayer(playerid);
- }
- INI_Int("Radio",PlayerInfo[playerid][pBoomBox]);
- INI_WriteInt(File,"Radio",PlayerInfo[playerid][pBoomBox]);
- NA KRAJU MODA
- public OnPlayerEnterDynamicArea(playerid, areaid)
- {
- foreach(Player, i)
- {
- if(GetPVarType(i, "BBArea"))
- {
- if(areaid == GetPVarInt(i, "BBArea"))
- {
- new station[256];
- GetPVarString(i, "BBStation", station, sizeof(station));
- if(!isnull(station))
- {
- PlayStream(playerid, station, GetPVarFloat(i, "BBX"), GetPVarFloat(i, "BBY"), GetPVarFloat(i, "BBZ"), 30.0, 1);
- //SendClientMessage(playerid, -1, "Pocinjete da cujete muziku u blizini");
- }
- return 1;
- }
- }
- }
- return 1;
- }
- //------------------------------------------------------------------------------
- public OnPlayerLeaveDynamicArea(playerid, areaid)
- {
- foreach(Player, i)
- {
- if(GetPVarType(i, "BBArea"))
- {
- if(areaid == GetPVarInt(i, "BBArea"))
- {
- StopStream(playerid);
- //SendClientMessage(playerid, -1, "Ne cujete vise muziku");
- return 1;
- }
- }
- }
- return 1;
- }
- stock StopStream(playerid)
- {
- DeletePVar(playerid, "pAudioStream");
- StopAudioStreamForPlayer(playerid);
- }
- stock PlayStream(playerid, url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0)
- {
- if(GetPVarType(playerid, "pAudioStream")) StopAudioStreamForPlayer(playerid);
- else SetPVarInt(playerid, "pAudioStream", 1);
- PlayAudioStreamForPlayer(playerid, url, posX, posY, posZ, distance, usepos);
- }
- stock PickUpBoombox(playerid)
- {
- foreach(Player, i)
- {
- if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "BBArea")))
- {
- StopStream(i);
- }
- }
- DeletePVar(playerid, "BBArea");
- DestroyDynamicObject(GetPVarInt(playerid, "PlacedBB"));
- DestroyDynamic3DTextLabel(Text3D:GetPVarInt(playerid, "BBLabel"));
- DeletePVar(playerid, "PlacedBB"); DeletePVar(playerid, "BBLabel");
- DeletePVar(playerid, "BBX"); DeletePVar(playerid, "BBY"); DeletePVar(playerid, "BBZ");
- DeletePVar(playerid, "BBInt");
- DeletePVar(playerid, "BBVW");
- DeletePVar(playerid, "BBStation");
- return 1;
- }
- stock SendNearbyMessage(playerid, Float:radius, string[], col1, col2, col3, col4, col5)
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- new Float:ix, Float:iy, Float:iz;
- new Float:cx, Float:cy, Float:cz;
- foreach(Player, i)
- {
- if(gPlayerLoggin{i})
- {
- if(GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
- {
- GetPlayerPos(i, ix, iy, iz);
- cx = (x - ix);
- cy = (y - iy);
- cz = (z - iz);
- if(((cx < radius/16) && (cx > -radius/16)) && ((cy < radius/16) && (cy > -radius/16)) && ((cz < radius/16) && (cz > -radius/16)))
- {
- SendClientMessage(i, col1, string);
- }
- else if(((cx < radius/8) && (cx > -radius/8)) && ((cy < radius/8) && (cy > -radius/8)) && ((cz < radius/8) && (cz > -radius/8)))
- {
- SendClientMessage(i, col2, string);
- }
- else if(((cx < radius/4) && (cx > -radius/4)) && ((cy < radius/4) && (cy > -radius/4)) && ((cz < radius/4) && (cz > -radius/4)))
- {
- SendClientMessage(i, col3, string);
- }
- else if(((cx < radius/2) && (cx > -radius/2)) && ((cy < radius/2) && (cy > -radius/2)) && ((cz < radius/2) && (cz > -radius/2)))
- {
- SendClientMessage(i, col4, string);
- }
- else if(((cx < radius) && (cx > -radius)) && ((cy < radius) && (cy > -radius)) && ((cz < radius) && (cz > -radius)))
- {
- SendClientMessage(i, col5, string);
- }
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement