Maler[CM] |
Дата: Суббота, 28.03.2015, 15:32 | Сообщение # 1
|
MOSKVASTAN
Сообщений: 440
Статус: Offline
|
Знаю, есть FS. Но там она на английском и работает совсем по другому (диалог открывается >> выбираешь другой диалог >> потом другой и только включается, а сейчас работает даже очень и на ОК) Автор системы: Неизвестно. Переписал систему: Maler[CM] (samuel_lecompte) Добавляем команды DC_CMD and ZCMD: Код CMD:recorder(playerid, params[]) { new string[128], Float:BBCoord[4], pName[MAX_PLAYER_NAME]; 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(GetPVarInt(playerid, "PlacedBB")) return SCM(playerid, -1, "Вы уже установили магнитофон, уберите его для начало"); 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, "Магнитофон установлен на землю"); return 1; } } } new string2[128]; format(string2, sizeof(string2), "%s установил магнитофон", pName); ProxDetector(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))); format(string, sizeof(string), "Установил: %s\n/setrecorder - Сменить песню\n/giverecorder - Убрать", pName); 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:setrecorder(playerid, params[]) { if(GetPVarType(playerid, "PlacedBB")) { if(IsPlayerInRangeOfPoint(playerid, 3.0, GetPVarFloat(playerid, "BBX"), GetPVarFloat(playerid, "BBY"), GetPVarFloat(playerid, "BBZ"))) ShowPlayerDialog(playerid,17504,DIALOG_STYLE_LIST,"Radio List","Record\nZaycev\nШансон\nРадио мелодия\nKiss FM (UA)\nSky Radio\nСвоя песня\nВыключить","Выбрать", "Выключить"); else return SendClientMessage(playerid, -1, "Вы не возле магнитофона"); } else SendClientMessage(playerid, -1, "Магнитофон не установлен"); return 1; } CMD:giverecorder(playerid, params[]) { if(!GetPVarInt(playerid, "PlacedBB")) SendClientMessage(playerid, -1, "Вы не ставили магнитофон"); if(IsPlayerInRangeOfPoint(playerid, 3.0, GetPVarFloat(playerid, "BBX"), GetPVarFloat(playerid, "BBY"), GetPVarFloat(playerid, "BBZ"))) { PickUpBoombox(playerid); SendClientMessage(playerid, -1, "Вы убрали магнитофон"); } return 1; } Создаем стоки: Код stock StopStream(playerid) { DeletePVar(playerid, "pAudioStream"); StopAudioStreamForPlayer(playerid); } 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 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); } В OnPlayerEnterDynamicArea (если нету создайте): Код 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, COLOR_GREEN, "Вы попали в игровую зону магнитофона"); } return 1; } } } Готовый OnPlayerEnterDynamicArea: Код 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, COLOR_GREEN, "Вы попали в игровую зону магнитофона"); } return 1; } } } return 1; } Далее идем в OnPlayerDisconnect: Код if(GetPVarType(playerid, "PlacedBB")) { DestroyDynamicObject(GetPVarInt(playerid, "PlacedBB")); DestroyDynamic3DTextLabel(Text3D:GetPVarInt(playerid, "BBLabel")); if(GetPVarType(playerid, "BBArea")) { foreach(Player,i) { if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "BBArea"))) { StopAudioStreamForPlayer(i); SendClientMessage(i, COLOR_LIGHTBLUE, "Игрок вышел из игры, магнитофон выключен"); } } } } Далее OnDialogResponse: Код case 17504: { if(!response) { SendClientMessage(playerid, COLOR_WHITE, "Выберите песню"); return 1; } switch(listitem) { case 0: { if(GetPVarType(playerid, "PlacedBB")) { foreach(Player, i) { if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "BBArea"))) { PlayStream(i, "http://air.radiorecord.ru:8102/club_128", GetPVarFloat(playerid, "BBX"), GetPVarFloat(playerid, "BBY"), GetPVarFloat(playerid, "BBZ"), 30.0, 1); } } SetPVarString(playerid, "BBStation", "http://air.radiorecord.ru:8102/club_128"); } } case 1: { if(GetPVarType(playerid, "PlacedBB")) { foreach(Player, i) { if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "BBArea"))) { PlayStream(i, "http://radio.zaycev.fm:9002/rnb/ZaycevFM(128).m3u", GetPVarFloat(playerid, "BBX"), GetPVarFloat(playerid, "BBY"), GetPVarFloat(playerid, "BBZ"), 30.0, 1); } } SetPVarString(playerid, "BBStation", "http://radio.zaycev.fm:9002/rnb/ZaycevFM(128).m3u"); } } case 2: { if(GetPVarType(playerid, "PlacedBB")) { foreach(Player, i) { if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "BBArea"))) { PlayStream(i, "http://radio02-cn03.akadostream.ru:8108/shanson128.mp3", GetPVarFloat(playerid, "BBX"), GetPVarFloat(playerid, "BBY"), GetPVarFloat(playerid, "BBZ"), 30.0, 1); } } SetPVarString(playerid, "BBStation", "http://radio02-cn03.akadostream.ru:8108/shanson128.mp3"); } } case 3: { if(GetPVarType(playerid, "PlacedBB")) { foreach(Player, i) { if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "BBArea"))) { PlayStream(i, "http://online-radiomelodia.tavrmedia.ua/RadioMelodia.m3u", GetPVarFloat(playerid, "BBX"), GetPVarFloat(playerid, "BBY"), GetPVarFloat(playerid, "BBZ"), 30.0, 1); } } SetPVarString(playerid, "BBStation", "http://online-radiomelodia.tavrmedia.ua/RadioMelodia.m3u"); } } case 4: { if(GetPVarType(playerid, "PlacedBB")) { foreach(Player, i) { if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "BBArea"))) { PlayStream(i, "http://kissfm.ua/v3/kiss-2.m3u", GetPVarFloat(playerid, "BBX"), GetPVarFloat(playerid, "BBY"), GetPVarFloat(playerid, "BBZ"), 30.0, 1); } } SetPVarString(playerid, "BBStation", "http://kissfm.ua/v3/kiss-2.m3u"); } } case 5: { if(GetPVarType(playerid, "PlacedBB")) { foreach(Player, i) { if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "BBArea"))) { PlayStream(i, "http://stream05.akaver.com/skyradio_hi.mp3", GetPVarFloat(playerid, "BBX"), GetPVarFloat(playerid, "BBY"), GetPVarFloat(playerid, "BBZ"), 30.0, 1); } } SetPVarString(playerid, "BBStation", "http://stream05.akaver.com/skyradio_hi.mp3"); } } case 6: ShowPlayerDialog(playerid,17511,DIALOG_STYLE_INPUT, "Введите ссылку", "Вставляйте ссылку на радио / песню", "Готово","Отменить"); case 7: { if(GetPVarType(playerid, "BBArea")) { new string[128], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid, pName, sizeof(pName)); format(string, sizeof(string), "%s выключил магнитофон", pName); ProxDetector(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); foreach(Player, i) if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "BBArea"))) StopStream(i); DeletePVar(playerid, "BBStation"); } SendClientMessage(playerid, COLOR_WHITE, "Вы выключили магнитофон"); } } } case 17511: { if(response) { if(isnull(inputtext)) { SendClientMessage(playerid, COLOR_WHITE, "Нельзя вставить пустую ссылку!" ); return 1; } if(strlen(inputtext)) { if(GetPVarType(playerid, "PlacedBB")) { foreach(Player, i) { if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "BBArea"))) PlayStream(i, inputtext, GetPVarFloat(playerid, "BBX"), GetPVarFloat(playerid, "BBY"), GetPVarFloat(playerid, "BBZ"), 30.0, 1); SetPVarString(playerid, "BBStation", inputtext); } } } } } Создаем паблик, если есть не создавайте: Код public OnPlayerLeaveDynamicArea(playerid, areaid) { foreach(Player, i) { if(GetPVarType(i, "BBArea")) { if(areaid == GetPVarInt(i, "BBArea")) { StopStream(playerid); SendClientMessage(playerid, COLOR_GREEN, "Вы покинули зону магнитофона"); return 1; } } } return 1; } И так, система готова. Команды для использования: /recorder - включить | /setrecorder - сменить песню | /giverecorder - убратьДобавлено (28.03.2015, 15:32) --------------------------------------------- Так же на проекте Love-Rp (не реклама) такая же система. Можно сказать сделал её копию, только тут текста изменены. Подойдет для нубо рп с бонусом.
ВК: https://vk.com/vdovkinn Skype: nikita24682 CM One Love:*
|
|
|
|