Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include mxINI
- #include streamer
- #define SEREGAMIL -1
- #define dcmd(%1,%2,%3) if((strcmp((%3)[1],#%1,true,(%2))==0)&&((((%3)[(%2)+1]==0)&&(dcmd_%1(playerid,"")))||(((%3)[(%2)+1]==32)&&(dcmd_%1(playerid,(%3)[(%2)+2]))))) return 1
- new hinter[16]={1,1,3,2,5,9,10,10,12,6,5,8,1,2,8};
- new Float:housepos[15][3]=
- {
- {244.6262,304.7528,999.1484},
- {2525.8909,-1679.1622,1015.4986},
- {2492.3103,-1696.4454,1014.7650},
- {268.0308,305.3448,999.1484},
- {2233.2769,-1113.8984,1050.8828},
- {2319.0813,-1025.5150,1050.2109},
- {2261.5200,-1136.9385,1050.6328},
- {2261.7595,-1209.9454,1049.0308},
- {2325.7488,-1147.4218,1050.7101},
- {346.3175,306.2907,999.1484},
- {140.2950,1368.9722,1083.8638},
- {2807.3604,-1171.7048,1025.5703},
- {2211.1682,-1075.7603,1050.4844},
- {2237.7590,-1078.3325,1049.0234},
- {2365.1089,-1133.0795,1050.8750}
- };
- #define m_house 500
- #define MAX_P_H 1
- new bool:texts;
- new count;
- enum hs
- {
- Float:pos[3],//street
- Float:ent[3],//house
- int,//interior
- own[24],//owner
- clas,//class
- cena,//price
- sell,//sell
- num,
- icon,
- pick,//pickup
- Text3D:htext[256]
- };
- new hinfo[m_house][hs];
- new bool:athouse[MAX_PLAYERS];
- new phouse[MAX_PLAYERS];
- main()
- {
- print("\n----------------------------------");
- print(" Blank Gamemode by your name here");
- print("----------------------------------\n");
- }
- public OnGameModeInit()
- {
- count=0;
- texts = true;//false - off
- loadHouses();
- return 1;
- }
- loadHouses()
- {
- for(new x;x!=m_house;x++)
- {
- new str[50];
- format(str,50,"houses/h_%d.ini",x);
- if(fexist(str))
- {
- new file = ini_openFile(str);
- ini_getInteger(file,"num",hinfo[x][num]);
- ini_getString(file,"own",hinfo[x][own],24);
- ini_getFloat(file,"px",hinfo[x][pos][0]);
- ini_getFloat(file,"py",hinfo[x][pos][1]);
- ini_getFloat(file,"pz",hinfo[x][pos][2]);
- ini_getFloat(file,"ex",hinfo[x][ent][0]);
- ini_getFloat(file,"ey",hinfo[x][ent][1]);
- ini_getFloat(file,"ez",hinfo[x][ent][2]);
- ini_getInteger(file,"int",hinfo[x][int]);
- ini_getInteger(file,"class",hinfo[x][clas]);
- ini_getInteger(file,"cena",hinfo[x][cena]);
- ini_getInteger(file,"sell",hinfo[x][sell]);
- count++;
- hinfo[x][pick] = CreatePickup(1273,23,hinfo[x][pos][0],hinfo[x][pos][1],hinfo[x][pos][2]);
- if(texts == true)
- {
- new hst[256];
- format(hst,256,"{00ff00}Дом {ffffff}#%d\n{00ff00}Владелец: {ffffff}%s\n{00ff00}Стоймость: {ffffff}%d\n{00ff00}Класс: {ffffff}%s",hinfo[x][num],hinfo[x][own],hinfo[x][cena],hclass(x));
- hinfo[x][htext] = CreateDynamic3DTextLabel(hst, 0xffffffff, hinfo[x][pos][0],hinfo[x][pos][1],hinfo[x][pos][2], 10.0);
- }
- if(strcmp(hinfo[x][own], "Nobody", true) == 0)
- hinfo[x][icon] = CreateDynamicMapIcon(hinfo[x][pos][0],hinfo[x][pos][1],hinfo[x][pos][2],31,0,-1,-1,-1,500.0);
- else
- hinfo[x][icon] = CreateDynamicMapIcon(hinfo[x][pos][0],hinfo[x][pos][1],hinfo[x][pos][2],32,0,-1,-1,-1,500.0);
- ini_closeFile(file);
- printf("House %d - loaded",x);
- }
- }
- return printf("Houses %d loaded",count);
- }
- public OnPlayerConnect(playerid)
- {
- phouse[playerid]=0;
- new name[24];
- GetPlayerName(playerid,name,24);
- for(new x;x!=m_house;x++)
- {
- if(strcmp(hinfo[x][own], "Nobody", true) == 0) continue;
- else if(strcmp(hinfo[x][own], name, true) == 0) phouse[playerid]++;
- }
- SetPVarInt(playerid,"ZHOUSE",0);
- athouse[playerid] = false;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- phouse[playerid]=0;
- SetPVarInt(playerid,"ZHOUSE",0);
- athouse[playerid] = false;
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- GivePlayerMoney(playerid,999999);
- SetPVarInt(playerid,"ZHOUSE",0);
- SetPlayerPos(playerid,1958.3783,1343.1572,15.3746);
- new name[24];
- GetPlayerName(playerid,name,24);
- for(new x;x!=m_house;x++)
- {
- if(strcmp(hinfo[x][own], "Nobody", true) == 0) continue;
- else if(strcmp(hinfo[x][own], name, true) == 0)
- {
- SetPVarFloat(playerid,"TheHPosx",hinfo[x][pos][0]);
- SetPVarFloat(playerid,"TheHPosy",hinfo[x][pos][1]);
- SetPVarFloat(playerid,"TheHPosz",hinfo[x][pos][2]);
- SetPVarInt(playerid,"TheInt",0);
- SetPlayerPos(playerid,hinfo[x][ent][0],hinfo[x][ent][1],hinfo[x][ent][2]);
- SetPlayerInterior(playerid,hinfo[x][int]);
- SetPlayerVirtualWorld(playerid,playerid+random(150));
- SetPVarInt(playerid,"Selling",hinfo[x][num]);
- athouse[playerid] = true;
- break;
- }
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- SetPVarInt(playerid,"ZHOUSE",0);
- athouse[playerid] = false;
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(add,3,cmdtext);
- dcmd(setint,6,cmdtext);
- dcmd(setcena,7,cmdtext);
- dcmd(setclass,8,cmdtext);
- dcmd(asellhouse,10,cmdtext);
- dcmd(sellhouse,9,cmdtext);
- return 0;
- }
- dcmd_sellhouse(playerid,params[])
- {
- #pragma unused params
- if(athouse[playerid] == true)
- {
- new hid = GetPVarInt(playerid,"Selling");
- GivePlayerMoney(playerid,hinfo[hid][sell]);
- new str[100];
- format(str,100,"houses/h_%d.ini",hid);
- new file = ini_openFile(str);
- ini_setString(file,"own","Nobody");
- ini_getString(file,"own",hinfo[hid][own],24);
- ini_closeFile(file);
- phouse[playerid]--;
- SetPlayerPos(playerid,GetPVarFloat(playerid,"TheHPosx"),GetPVarFloat(playerid,"TheHPosy"),GetPVarFloat(playerid,"TheHPosz"));
- SetPlayerInterior(playerid,GetPVarInt(playerid,"TheInt"));
- SetPlayerVirtualWorld(playerid,0);
- DestroyDynamicMapIcon(hinfo[hid][icon]);
- hinfo[hid][icon] = CreateDynamicMapIcon(hinfo[hid][pos][0],hinfo[hid][pos][1],hinfo[hid][pos][2],31,0,-1,-1,-1,500.0);
- athouse[playerid] = false;
- SendClientMessage(playerid,-1,"Вы продали дом и получили половину его стоймости");
- if(texts == true)
- {
- new hst[256];
- format(hst,256,"{00ff00}Дом {ffffff}#%d\n{00ff00}Владелец: {ffffff}%s\n{00ff00}Стоймость: {ffffff}%d\n{00ff00}Класс: {ffffff}%s",hinfo[hid][num],hinfo[hid][own],hinfo[hid][cena],hclass(hid));
- UpdateDynamic3DTextLabelText(hinfo[hid][htext],-1,hst);
- }
- return 1;
- }
- return 1;
- }
- dcmd_asellhouse(playerid,params[])
- {
- if(!IsPlayerAdmin(playerid)) return 0;
- if(!strlen(params)) return SendClientMessage(playerid,-1,"*/asellhouse [id]");
- new home = strval(params);
- for(new x;x!=m_house;x++)
- {
- if(home == x)
- {
- if(!(strcmp(hinfo[x][own], "Nobody", true) == 0))
- {
- new str[50];
- format(str,50,"houses/h_%d.ini",x);
- if(fexist(str))
- {
- new file = ini_openFile(str);
- new s[24];
- format(s,24,"Nobody");
- ini_setString(file,"own",s);
- ini_closeFile(file);
- hinfo[x][own] = s;
- new st[100];
- format(st,100,"{ffffff}Дом {00ff00}%d {ffffff}успешно продан",home);
- SendClientMessage(playerid,-1,st);
- DestroyDynamicMapIcon(hinfo[x][icon]);
- hinfo[x][icon] = CreateDynamicMapIcon(hinfo[x][pos][0],hinfo[x][pos][1],hinfo[x][pos][2],31,0,-1,-1,-1,500.0);
- if(texts == true)
- {
- new hst[256];
- format(hst,256,"{00ff00}Дом {ffffff}#%d\n{00ff00}Владелец: {ffffff}%s\n{00ff00}Стоймость: {ffffff}%d\n{00ff00}Класс: {ffffff}%s",hinfo[x][num],hinfo[x][own],hinfo[x][cena],hclass(x));
- UpdateDynamic3DTextLabelText(hinfo[x][htext],-1,hst);
- }
- break;
- }
- }
- break;
- }
- }
- return 1;
- }
- dcmd_setint(playerid,params[])
- {
- if(!IsPlayerAdmin(playerid)) return 0;
- if(!strlen(params[0])) return SendClientMessage(playerid,-1,"*/setint [id] [id int]");
- if(!strlen(params[1])) return SendClientMessage(playerid,-1,"*/setint [id] [id int]");
- for(new x;x!=m_house;x++)
- {
- if(strval(params[0]) == x)
- {
- new str[50];
- format(str,50,"houses/h_%d.ini",x);
- if(fexist(str))
- {
- new file = ini_openFile(str);
- ini_setFloat(file,"ex",housepos[strval(params[1])][0]);
- ini_setFloat(file,"ey",housepos[strval(params[1])][1]);
- ini_setFloat(file,"ez",housepos[strval(params[1])][2]);
- ini_setInteger(file,"int",hinter[strval(params[1])]);
- ini_closeFile(file);
- hinfo[x][ent][0] = housepos[strval(params[1])][0];
- hinfo[x][ent][1] = housepos[strval(params[1])][1];
- hinfo[x][ent][2] = housepos[strval(params[1])][2];
- hinfo[x][int] = hinter[strval(params[1])];
- new st[100];
- format(st,100,"{ffffff}Интерьер дома {00ff00}%d {ffffff}сменен на {00ff00}%d",strval(params[0]),strval(params[1]));
- SendClientMessage(playerid,-1,st);
- break;
- }
- else
- break;
- }
- }
- return 1;
- }
- dcmd_setcena(playerid,params[])
- {
- if(!IsPlayerAdmin(playerid)) return 0;
- if(!strlen(params[0])) return SendClientMessage(playerid,-1,"*/setcena [id] [value]");
- if(!strlen(params[1])) return SendClientMessage(playerid,-1,"*/setcena [id] [value]");
- for(new x;x!=m_house;x++)
- {
- if(strval(params[0]) == x)
- {
- new str[50];
- format(str,50,"houses/h_%d.ini",x);
- if(fexist(str))
- {
- new file = ini_openFile(str);
- ini_setInteger(file,"cena",strval(params[1]));
- ini_closeFile(file);
- hinfo[x][cena] = strval(params[1]);
- new st[100];
- format(st,100,"{ffffff}Цена дома {00ff00}%d {ffffff}сменена на {00ff00}%d",strval(params[0]),strval(params[1]));
- SendClientMessage(playerid,-1,st);
- if(texts == true)
- {
- new hst[256];
- format(hst,256,"{00ff00}Дом {ffffff}#%d\n{00ff00}Владелец: {ffffff}%s\n{00ff00}Стоймость: {ffffff}%d\n{00ff00}Класс: {ffffff}%s",hinfo[x][num],hinfo[x][own],hinfo[x][cena],hclass(x));
- UpdateDynamic3DTextLabelText(hinfo[x][htext],-1,hst);
- }
- break;
- }
- else
- break;
- }
- }
- return 1;
- }
- dcmd_setclass(playerid,params[])
- {
- if(!IsPlayerAdmin(playerid)) return 0;
- if(!strlen(params[0])) return SendClientMessage(playerid,-1,"*/setclass [id] [class]");
- if(!strlen(params[1])) return SendClientMessage(playerid,-1,"*/setclass [id] [class]");
- for(new x;x!=m_house;x++)
- {
- if(strval(params[0]) == x)
- {
- new str[50];
- format(str,50,"houses/h_%d.ini",x);
- if(fexist(str))
- {
- new file = ini_openFile(str);
- ini_setInteger(file,"class",strval(params[1]));
- ini_closeFile(file);
- hinfo[x][clas] = strval(params[1]);
- new st[100];
- format(st,100,"{ffffff}Класс дома {00ff00}%d {ffffff}сменен на {00ff00}\"%s\"",strval(params[0]),hclass(x));
- SendClientMessage(playerid,-1,st);
- if(texts == true)
- {
- new hst[256];
- format(hst,256,"{00ff00}Дом {ffffff}#%d\n{00ff00}Владелец: {ffffff}%s\n{00ff00}Стоймость: {ffffff}%d\n{00ff00}Класс: {ffffff}%s",hinfo[x][num],hinfo[x][own],hinfo[x][cena],hclass(x));
- UpdateDynamic3DTextLabelText(hinfo[x][htext],-1,hst);
- }
- break;
- }
- else
- break;
- }
- }
- return 1;
- }
- dcmd_add(playerid,params[])
- {
- if(!IsPlayerAdmin(playerid)) return 0;
- if(!strlen(params[0])) return SendClientMessage(playerid,-1,"Ну а интерьер за тебя таджики укажут");
- if(!strlen(params[1])) return SendClientMessage(playerid,-1,"Цену за тебя таджики укажут");
- if(count == m_house) return SendClientMessage(playerid,-1,"Лимит домиков на сервере");
- new numb = strval(params[1]);
- if(strval(params[0]) < 0 || strval(params[0]) > 16) return SendClientMessage(playerid,-1,"Интерьер от 1 до 15 включительно");
- new Float:ps[3];
- GetPlayerPos(playerid,ps[0],ps[1],ps[2]);
- count++;
- new str[256];
- format(str,256,"houses/h_%d.ini",count);
- new file = ini_createFile(str);
- if(file<0) ini_openFile(str);
- ini_setInteger(file,"num",count);
- ini_setString(file,"own","Nobody");
- ini_setFloat(file,"px",ps[0]);
- ini_setFloat(file,"py",ps[1]);
- ini_setFloat(file,"pz",ps[2]);
- ini_setFloat(file,"ex",housepos[strval(params[0])][0]);
- ini_setFloat(file,"ey",housepos[strval(params[0])][1]);
- ini_setFloat(file,"ez",housepos[strval(params[0])][2]);
- ini_setInteger(file,"int",hinter[strval(params[0])]);
- ini_setInteger(file,"class",1);
- ini_setInteger(file,"cena",numb);
- ini_setInteger(file,"sell",numb/2);
- ini_closeFile(file);
- SetPVarInt(playerid,"ChangeClass",count);
- SetPVarInt(playerid,"ZHOUSE",1);
- ShowPlayerDialog(playerid,6336,DIALOG_STYLE_INPUT," ","Введите класс для дома","Ок", " ");
- return 1;
- }
- loading(x)
- {
- new str[50];
- format(str,50,"houses/h_%d.ini",x);
- if(!fexist(str)) return 0;
- new file = ini_openFile(str);
- ini_getInteger(file,"num",hinfo[x][num]);
- ini_getString(file,"own",hinfo[x][own],24);
- ini_getFloat(file,"px",hinfo[x][pos][0]);
- ini_getFloat(file,"py",hinfo[x][pos][1]);
- ini_getFloat(file,"pz",hinfo[x][pos][2]);
- ini_getFloat(file,"ex",hinfo[x][ent][0]);
- ini_getFloat(file,"ey",hinfo[x][ent][1]);
- ini_getFloat(file,"ez",hinfo[x][ent][2]);
- ini_getInteger(file,"int",hinfo[x][int]);
- ini_getInteger(file,"class",hinfo[x][clas]);
- ini_getInteger(file,"cena",hinfo[x][cena]);
- ini_getInteger(file,"sell",hinfo[x][sell]);
- if(texts == true)
- {
- new hst[256];
- format(hst,256,"{00ff00}Дом {ffffff}#%d\n{00ff00}Владелец: {ffffff}%s\n{00ff00}Стоймость: {ffffff}%d\n{00ff00}Класс: {ffffff}%s",hinfo[x][num],hinfo[x][own],hinfo[x][cena],hclass(x));
- hinfo[x][htext] = CreateDynamic3DTextLabel(hst, 0xffffffff, hinfo[x][pos][0],hinfo[x][pos][1],hinfo[x][pos][2], 10.0);
- }
- hinfo[x][pick] = CreatePickup(1273,23,hinfo[x][pos][0],hinfo[x][pos][1],hinfo[x][pos][2]);
- if(strcmp(hinfo[x][own], "Nobody", true) == 0)
- hinfo[x][icon] = CreateDynamicMapIcon(hinfo[x][pos][0],hinfo[x][pos][1],hinfo[x][pos][2],31,0,-1,-1,-1,500.0);
- else
- hinfo[x][icon] = CreateDynamicMapIcon(hinfo[x][pos][0],hinfo[x][pos][1],hinfo[x][pos][2],32,0,-1,-1,-1,500.0);
- ini_closeFile(file);
- printf("House %d - loaded",count);
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- if(GetPVarInt(playerid,"ZHOUSE") == 0)
- {
- new x = IsPlayerNearHouse(playerid);
- if(x!=-1)
- {
- if(pickupid == hinfo[x][pick])
- {
- new name[24];
- GetPlayerName(playerid,name,24);
- if(strcmp(hinfo[x][own], name, true) == 0)
- {//его дом
- GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~Press ~y~ALT ~w~to enter",5000,3);
- }
- else if(strcmp(hinfo[x][own], "Nobody", true) == 0)
- {//ничей
- new str[256];
- format(str,256,"{ffffff}Номер дома:\t {00ff00}%d\n{ffffff}Цена дома:\t {00ff00}%d\n{ffffff}Класс дома:\t {00ff00}%s",hinfo[x][num],hinfo[x][cena],hclass(x));
- ShowPlayerDialog(playerid,174,DIALOG_STYLE_MSGBOX," ",str,"Купить","Выход");
- }
- else
- {
- new str[256];
- format(str,256,"{ffffff}Номер дома:\t {00ff00}%d\n{ffffff}Цена дома:\t {00ff00}%d\n{ffffff}Класс дома:\t {00ff00}%s\n{ffffff}Владелец:\t {00ff00}%s",hinfo[x][num],hinfo[x][cena],hclass(x),hinfo[x][own]);
- ShowPlayerDialog(playerid,174,DIALOG_STYLE_MSGBOX," ",str,"Прочел","");
- }
- }
- }
- }
- return 1;
- }
- stock hclass(x)
- {
- new str[140];
- switch(hinfo[x][clas])
- {
- case 1:format(str,256,"Элитный");
- case 2:format(str,256,"Средний");
- case 3:format(str,256,"Хреновый");
- }
- return str;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys == KEY_WALK)
- {
- if(athouse[playerid] == true)
- {
- SetPlayerPos(playerid,GetPVarFloat(playerid,"TheHPosx"),GetPVarFloat(playerid,"TheHPosy"),GetPVarFloat(playerid,"TheHPosz"));
- SetPlayerInterior(playerid,GetPVarInt(playerid,"TheInt"));
- SetPlayerVirtualWorld(playerid,0);
- athouse[playerid] = false;
- }
- else
- {
- new x = IsPlayerNearHouse(playerid);
- if(x == -1) return 1;
- new Float:pz[3];
- GetPlayerPos(playerid,pz[0],pz[1],pz[2]);
- SetPVarFloat(playerid,"TheHPosx",pz[0]);
- SetPVarFloat(playerid,"TheHPosy",pz[1]);
- SetPVarFloat(playerid,"TheHPosz",pz[2]);
- SetPVarInt(playerid,"TheInt",GetPlayerInterior(playerid));
- SetPlayerPos(playerid,hinfo[x][ent][0],hinfo[x][ent][1],hinfo[x][ent][2]);
- SetPlayerInterior(playerid,hinfo[x][int]);
- SetPlayerVirtualWorld(playerid,playerid+random(150));
- SetPVarInt(playerid,"Selling",hinfo[x][num]);
- athouse[playerid] = true;
- GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~Press ~y~ALT ~w~to exit",5000,3);
- }
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == 174)
- {
- if(!response) return 1;
- if(response)
- {//купил
- new hid = IsPlayerNearHouse(playerid);
- if(hid == -1) return SendClientMessage(playerid,-1,"...Встаньте на пикап");
- if(GetPlayerMoney(playerid)<hinfo[hid][cena]) return SendClientMessage(playerid,-1,"...Недостаточно денег для приобретения дома");
- if(phouse[playerid] == MAX_P_H) return SendClientMessage(playerid,-1,"Максимум");
- if(strcmp(hinfo[hid][own], "Nobody", true) == 0)
- {
- GivePlayerMoney(playerid,-hinfo[hid][cena]);
- new str[100];
- new name[24];
- GetPlayerName(playerid,name,24);
- format(str,100,"houses/h_%d.ini",hid);
- new file = ini_openFile(str);
- ini_setString(file,"own",name);
- hinfo[hid][own]=name;
- ini_closeFile(file);
- SendClientMessage(playerid,-1,"Вы успешно приобрели дом!");
- phouse[playerid]++;
- DestroyDynamicMapIcon(hinfo[hid][icon]);
- hinfo[hid][icon] = CreateDynamicMapIcon(hinfo[hid][pos][0],hinfo[hid][pos][1],hinfo[hid][pos][2],32,0,-1,-1,-1,500.0);
- if(texts == true)
- {
- new hst[256];
- format(hst,256,"{00ff00}Дом {ffffff}#%d\n{00ff00}Владелец: {ffffff}%s\n{00ff00}Стоймость: {ffffff}%d\n{00ff00}Класс: {ffffff}%s",hinfo[hid][num],hinfo[hid][own],hinfo[hid][cena],hclass(hid));
- UpdateDynamic3DTextLabelText(hinfo[hid][htext],-1,hst);
- }
- return 1;
- }
- else SendClientMessage(playerid,-1,"...Это ваш дом");
- return 1;
- }
- }
- if(dialogid == 6336)
- {
- if(!response) return ShowPlayerDialog(playerid,6336,DIALOG_STYLE_INPUT," ","Введите класс для дома","Ок", " ");
- if(response)
- {
- if(!strlen(inputtext)) ShowPlayerDialog(playerid,6336,DIALOG_STYLE_INPUT," ","Введите класс для дома","Ок", " ");
- if(strval(inputtext) < 1 || strval(inputtext) > 3) return ShowPlayerDialog(playerid,6336,DIALOG_STYLE_INPUT," ","Введите класс для дома","Ок", " ");
- if(GetPVarInt(playerid,"ChangeClass")!=SEREGAMIL)
- {
- new str[50];
- format(str,50,"houses/h_%d.ini",GetPVarInt(playerid,"ChangeClass"));
- if(fexist(str))
- {
- new file = ini_openFile(str);
- ini_setInteger(file,"class",strval(inputtext));
- ini_closeFile(file);
- loading(GetPVarInt(playerid,"ChangeClass"));
- ShowPlayerDialog(playerid,5628,DIALOG_STYLE_MSGBOX," ","Дом успешно создан","OK","");
- }
- }
- }
- SetPVarInt(playerid,"ChangeClass",SEREGAMIL);
- SetPVarInt(playerid,"ZHOUSE",0);
- return true;
- }
- return 1;
- }
- forward IsPlayerNearHouse(playerid);
- public IsPlayerNearHouse(playerid)
- {
- new Float:Distance;
- for(new x; x!=m_house; x++)
- {
- Distance = GetDistanceToHouse(playerid, x);
- if(Distance < 1.5) return x;
- }
- return -1;
- }
- forward Float:GetDistanceToHouse(playerid, Property);
- public Float:GetDistanceToHouse(playerid, Property)
- {
- new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
- GetPlayerPos(playerid,x1,y1,z1);
- x2 = hinfo[Property][pos][0];
- y2 = hinfo[Property][pos][1];
- z2 = hinfo[Property][pos][2];
- return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement