[CM]ExtazZz |
Дата: Суббота, 22.09.2012, 09:36 | Сообщение # 1
|
Боец
Сообщений: 158
Статус: Offline
|
Приступим. 1. Ко всем forward"s Добавляем
Code forward zatypokbar(playerid);
2. Создаем public zatypokbar(playerid) В него Добавим
Code { if(IsPlayerConnected(playerid)) { if(PlayerToPoint(4.0,playerid,X,Y,Z) || PlayerToPoint(4.0,playerid,X,Y,Z)) { return true; } } return false: } 4.0 это радиус действия. X.Y.Z - это координаты бара , пишем свои
3. Затем ко всем new добавим:
Code new Menu:BarMenu; 4.В public OnPlayerSelectedMenuRow(playerid, row) добавим PHP код: if(Current == BarMenu) { switch(row) { case 0: { NormMoney[playerid] = 2; AntiMoney[playerid] = AntiMoney[playerid] - 10; GivePlayerMoney(playerid, - 10); GameTextForPlayer(playerid, "~r~-10$", 3000, 1); GivePlayerMoney(playerid, -2); GameTextForPlayer(playerid, "~r~-2$", 3000, 1); if(health < 160) { GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "%s выпил стакан Соды ", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); GetPlayerHealth(playerid,health); SetPlayerHealth(playerid,health+5); } else { SendClientMessage(playerid, COLOR_GREY, ">> Бармен отказывается продавать вам напитки!"); TogglePlayerControllable(playerid,1); return 1; } TogglePlayerControllable(playerid,0); ShowMenuForPlayer(Menu:BarMenu, playerid); } case 1: { NormMoney[playerid] = 2; AntiMoney[playerid] = AntiMoney[playerid] - 10; GivePlayerMoney(playerid, - 10); GameTextForPlayer(playerid, "~r~-10$", 3000, 1); PlayerDrunk[playerid] += 2; if(health < 160) { if(GetPlayerDrunkLevel(playerid) < 20000) { SetPlayerDrunkLevel(playerid,GetPlayerDrunkLevel(playerid)+1000); } GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "%s выпил стакан Водки ", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 25; SetPlayerHealth(playerid, health + hp); } else { SetPlayerHealth(playerid, health + 25.0); } } else { SendClientMessage(playerid, COLOR_GREY, ">> Бармен отказывается продавать вам напитки!"); TogglePlayerControllable(playerid,1); return 1; } TogglePlayerControllable(playerid,0); ShowMenuForPlayer(Menu:BarMenu, playerid); } case 2: { NormMoney[playerid] = 2; AntiMoney[playerid] = AntiMoney[playerid] - 10; GivePlayerMoney(playerid, - 10); GameTextForPlayer(playerid, "~r~-10$", 3000, 1); PlayerDrunk[playerid] += 2; if(GetPlayerHealth(playerid, health) < 100) { if(GetPlayerDrunkLevel(playerid) < 20000) { SetPlayerDrunkLevel(playerid,GetPlayerDrunkLevel(playerid)+2000); } TogglePlayerControllable(playerid,1); ShowMenuForPlayer(Menu:BarMenu, playerid); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "%s выпил стакан Виски ", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 25; SetPlayerHealth(playerid, health + hp); } else { SetPlayerHealth(playerid, health + 25.0); } } else { SendClientMessage(playerid, COLOR_GREY, ">> Бармен отказывается продавать вам напитки!"); TogglePlayerControllable(playerid,1); return 1; } TogglePlayerControllable(playerid,0); ShowMenuForPlayer(Menu:BarMenu, playerid); } case 3: { NormMoney[playerid] = 2; AntiMoney[playerid] = AntiMoney[playerid] - 6; GivePlayerMoney(playerid, - 6); GameTextForPlayer(playerid, "~r~-6$", 3000, 1); PlayerDrunk[playerid] += 1; if(GetPlayerDrunkLevel(playerid) <= 20000) { SetPlayerDrunkLevel(playerid,GetPlayerDrunkLevel(playerid)+500); } GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "%s выпил стакан Воды ", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); if(PlayerDrunk[playerid] >= 5) { GameTextForPlayer(playerid, "~w~You are~n~~p~Drunk", 3500, 1); } if(health < 160) { if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 15; SetPlayerHealth(playerid, health + hp); } else { SetPlayerHealth(playerid, health + 15.0); } } else { SendClientMessage(playerid, COLOR_GREY, ">>Бармен отказывается продавать вам напитки!"); TogglePlayerControllable(playerid,1); return 1; } TogglePlayerControllable(playerid,0); ShowMenuForPlayer(Menu:BarMenu, playerid); } case 4: { NormMoney[playerid] = 2; AntiMoney[playerid] = AntiMoney[playerid] - 2; GivePlayerMoney(playerid, - 2); GameTextForPlayer(playerid, "~r~-2$", 3000, 1); if(health < 160) { GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "%s выпил стакан Пиво ", sendername); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); GetPlayerHealth(playerid,health); SetPlayerHealth(playerid,health+8); } else { SendClientMessage(playerid, COLOR_GREY, ">>Бармен отказывается продавать вам напитки!"); TogglePlayerControllable(playerid,1); return 1; } TogglePlayerControllable(playerid,0); ShowMenuForPlayer(Menu:BarMenu, playerid); } } return 1; } 5.В public OnPlayerExitedMenu добавить:
Code if(Current == BarMenu) { TogglePlayerControllable(playerid, 1); } 6.В public OnGameModeInit добавить:
Code BarMenu = CreateMenu("BarMenu", 0, 55.0, 200.0, 100.0, 80.0); //само меню! название напитков и цены можете заменить , но не забываем менять и в OnPlayerSelectedMenuRow AddMenuItem(BarMenu, 0, "Soda 2$"); AddMenuItem(BarMenu, 0, "Vodka 10$"); AddMenuItem(BarMenu, 0, "Viski 10$"); AddMenuItem(BarMenu, 0, "Voda 2$"); AddMenuItem(BarMenu, 0, "Beer 6$"); 7.Ко всем командам добавим:
Code if(strcmp(cmd, "/magaz", true) == 0) { if(IsPlayerConnected(playerid)) //проверка на вход { if(zatypokbar(playerid)) //проверяем в баре ли мы { if(PlayerDrunk[playerid] < 10) //если больше 10 то не можем пить { TogglePlayerControllable(playerid,0); ShowMenuForPlayer(Menu:BarMenu, playerid); //показываем меню } else { SendClientMessage(playerid, COLOR_RED, " >>Бармен отказывается продавать вам напитки!"); //ну это понятно return 1; } } else { SendClientMessage(playerid, COLOR_RED, "[x] Вы не в Баре!"); // тоже понятно return 1; } } return 1; } 8.Для правильной работы PlayerToPoint добавим в конец мода (P.S если есть не вставляем)
Code stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z) { if(IsPlayerConnected(playerid)) { new Float:oldposx, Float:oldposy, Float:oldposz; new Float:tempposx, Float:tempposy, Float:tempposz; GetPlayerPos(playerid, oldposx, oldposy, oldposz); tempposx = (oldposx -x); tempposy = (oldposy -y); tempposz = (oldposz -z); if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) return 1; } return 0; } Всё) Всем спасибо за просмотр
|
|
|
|