Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Авторы: frog163 (код), Essle (идея, координаты)
- //ver1.2 (21/11/2012) - месяц до конца ;D
- #include <a_samp>
- #define dial_rub 13548
- enum rub_inf{rub_eat, rub_id, rub_use, rub_item[5], rub_ticks, rub_spawn};
- new pi[MAX_PLAYERS][rub_inf];
- new Float:coord_rubbish[60][3] = {
- {706.44970, -1868.288, 5.40530},{433.47780, -1747.789, 9.20910},{1020.2922, -1370.158, 13.5557},{2482.2393, -1539.644, 24.0529},{665.22440, -623.3416, 16.3359},{668.25450, -623.4119, 16.3359},
- {1368.2468, 483.17370, 20.0276},{831.17250, -754.8876, 85.3125},{2320.0833, 14.314600, 26.4766},{1919.8068, -2088.174, 13.5803},{1920.1069, -2123.145, 13.5849},{255.37350, -133.6588, 1.57810},
- {259.68970, -133.8148, 1.57810},{1419.9714, -1355.812, 13.5636},{1439.9532, -1324.729, 13.5449},{1424.5007, -1320.657, 13.5547},{1424.5394, -1317.951, 13.5547},{1415.5901, -1300.219, 13.5450},
- {1337.5129, -1816.416, 13.5469},{1337.0326, -1843.056, 13.5469},{1660.7600, -1001.314, 24.0460},{1666.8646, -998.6257, 24.0543},{1829.5341, -1084.263, 23.8814},{1829.5391, -1097.156, 23.8823},
- {1829.5399, -1113.888, 23.8765},{1829.5847, -1143.721, 23.8809},{1829.5399, -1147.461, 23.8822},{1800.3743, -1147.267, 23.8410},{1786.1982, -1147.266, 23.8725},{1788.8701, -1112.512, 24.0859},
- {1788.7521, -1115.898, 24.0859},{2247.2285, -1083.271, 41.6016},{1461.4281, -1488.460, 13.5469},{1633.1481, -991.2181, 24.0776},{1631.0746, -988.4139, 24.0757},{1538.1969, -1849.265, 13.5469},
- {1516.7352, -1849.304, 13.5469},{1486.2128, -1847.384, 13.5469},{1468.7784, -1847.650, 13.5469},{1466.1975, -1847.893, 13.5469},{1420.4850, -1846.494, 13.5469},{1420.4072, -1844.248, 13.5469},
- {1616.6780, -1201.350, 19.8059},{1660.5033, -1201.405, 19.7931},{1593.1951, -1201.409, 19.8159},{1521.2386, -1018.571, 23.9108},{1521.2343, -1014.755, 23.9755},{1425.6398, -1084.340, 17.5536},
- {1425.6172, -1080.487, 17.5583},{1438.1196, -1094.793, 17.6086},{1435.4872, -1094.758, 17.5950},{1612.0013, -994.8882, 24.0781},{1384.5127, -1894.332, 13.4800},{1175.3978, -1878.592, 13.5733},
- {1117.4015, -1876.006, 13.5469},{1102.1302, -1876.006, 13.5469},{1093.0156, -1876.780, 13.5469},{1093.0381, -1881.252, 13.5469},{657.83260, -649.0323, 16.3359},{1337.7872, -1773.970, 13.5469}
- };
- #define all_item 12
- new rub_str[all_item][2][32] = {
- {"Огурец", "съел его"}, {"Тухлое мясо", "съел его"}, {"Молоко", "выпил его"}, {"Помидор", "съел его"}, {"Картошка", "съел ее"}, {"Сметана", "отлизал ее"}, {"Пирожоное", "съел его"},
- {"Кусок хлеба", "съел его"}, {"Морковка", "съел ее"}, {"Тухлая рыба", "съел ее"}, {"Кефир", "выпил его"}, {"Салат", "съел его"}
- };
- public OnPlayerSpawn(playerid){
- if(!pi[playerid][rub_spawn]){
- ApplyAnimation(playerid,"FOOD","null",0.0,0,0,0,0,0);
- ApplyAnimation(playerid,"BOMBER","null",0.0,0,0,0,0,0);
- pi[playerid][rub_spawn] = true;
- }
- return true;
- }
- public OnPlayerConnect(playerid){
- pi[playerid][rub_eat] = false;
- pi[playerid][rub_use] = false;
- pi[playerid][rub_spawn] = false;
- return true;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){
- if(newkeys & KEY_WALK && !pi[playerid][rub_use] && pi[playerid][rub_id] > -1)
- rubbish(playerid);
- return true;
- }
- public OnPlayerUpdate(playerid){
- if(pi[playerid][rub_eat] < 1)pi[playerid][rub_eat] = 0;
- else pi[playerid][rub_eat]--;
- if(pi[playerid][rub_ticks] > GetTickCount())return true;
- if(is_player_in_rubbish(playerid))
- GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~PRESS ~y~~k~~SNEAK_ABOUT~", 1200, 3);
- else pi[playerid][rub_use] = 0;
- pi[playerid][rub_ticks]=((pi[playerid][rub_id]!=-1)?5000:250)+GetTickCount();
- return true;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
- if(dialogid == dial_rub){
- pi[playerid][rub_use] = false;
- if(!response) return true;
- if(listitem == 5)return rubbish(playerid);
- new str[128];
- ApplyAnimation(playerid, "FOOD", "EAT_Burger", 4.1, 0, 1, 1, 1, 1, 1);
- format(str, sizeof str, "{d4d4d4}Ты достал из мусорки {9DDAF2}%s {d4d4d4}и %s.", rub_str[pi[playerid][rub_item][listitem]][0], rub_str[pi[playerid][rub_item][listitem]][1]);
- SendClientMessage(playerid, -1, str);
- if(pi[playerid][rub_eat] >= 1500+random(1000)){
- pi[playerid][rub_eat] = 0;
- SendClientMessage(playerid, -1, "{fddd00}Твой желудок не справился с таким количеством говна :(");
- ApplyAnimation(playerid, "FOOD", "EAT_Vomit_P", 4.0, 0, 1, 1, 1, 1, 1);
- }else{
- new Float:health;
- GetPlayerHealth(playerid, health);
- health += random(10)+3;
- SetPlayerHealth(playerid, health>100.0?100.0:health);
- pi[playerid][rub_eat] += 1000;
- }
- }
- return true;
- }
- forward rubbish(playerid);
- public rubbish(playerid){
- switch(pi[playerid][rub_use]++){
- case 0:{
- turn_player_face_to_coord(playerid, coord_rubbish[pi[playerid][rub_id]][0], coord_rubbish[pi[playerid][rub_id]][1]);
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant_Loop", 4.1, 1, 1, 1, 1, 5500, 1);
- SetTimerEx("rubbish", 5000, false, "d", playerid);
- SetPlayerChatBubble(playerid, "Роется в мусорке", 0x00FF00FF, 30.0, 5000);
- }
- case 1:show_rubdialog(playerid);
- }
- return true;
- }
- turn_player_face_to_coord(playerid, Float:x, Float:y){
- new Float:pPos[3];
- GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
- SetPlayerFacingAngle(playerid, 180.0-atan2(pPos[0] - x, pPos[1] - y));
- return true;
- }
- is_player_in_rubbish(playerid){
- for(new f = sizeof coord_rubbish -1; f != -1; --f)
- if(IsPlayerInRangeOfPoint(playerid, 1.0, coord_rubbish[f][0], coord_rubbish[f][1], coord_rubbish[f][2])){
- pi[playerid][rub_id] = f;
- return true;
- }
- pi[playerid][rub_id] = -1;
- return false;
- }
- show_rubdialog(playerid){
- new str[256];
- for(new f, rub_rand; f<5; ++f){
- rub_rand = random(all_item);
- format(str, sizeof str, "%s{00d400}[%d] {868686}%s\n", str, f+1, rub_str[rub_rand][0]);
- pi[playerid][rub_item][f] = rub_rand;
- }
- strcat(str, "{d46500}[6] {868686}Искать еще..");
- ShowPlayerDialog(playerid, dial_rub, DIALOG_STYLE_LIST, "{d46500}Мусорка", str, "Выбрать", "Отмена");
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement