Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <DOF2>
- #include <zcmd>
- #include <streamer>
- #define FILTERSCRIPT
- //----> Configurações
- #define FOLDER_PROPRIEDADES "Propriedades/Prop_%d.txt" //Local onde as propriedades serão salvas.
- #define MAX_PROPRIEDADES_SERVIDOR 150 //Número máximo de propriedades no servidor.
- #define MAX_PROPRIEDADES_POR_PLAYER 4 //Máximo de propriedades que um jogador pode comprar/obter/possuir.
- #define ICONE_PROP_COMPRADA 43 //ID do icone (MapIcon) quando a propriedade está comprada.
- #define ICONE_PROP_NORMAL 44 //ID do icone (MapIcon) quando a propriedade não está comprada.
- #define PICKUP_PROP_COMPRADA 1272 //ID da Pickup quando a propriedade está comprada.
- #define PICKUP_PROP_NORMAL 1273 //ID da Pickup quando a propriedade não está comprada.
- #define MINUTOS_GANHOS_PROP 30*60000 //Minutos para o jogador ganhar a 'recompensa' da propriedade, ou seja, 10% do valor original. Modifique apenas o 30 (meia hora)
- #define DIAS_AUTO_VENDER 3*86400000 //Dias para a propriedade ser auto-vendida, ou seja, se o jogador não entrar no servidor durante os dias definidos (3), a propriedade é automaticamente vendida.
- //----> Dialogs
- #define DIALOG_PROP_INFOS (940)
- #define DIALOG_PROP_AJUSTES (941)
- #define DIALOG_PROP_NOME (942)
- #define DIALOG_PROP_VENDER (943)
- #define DIALOG_PROP_ADMIN_HOME (944)
- #define DIALOG_PROP_NEW_NOME (945)
- #define DIALOG_PROP_NEW_PRECO (946)
- #define DIALOG_PROP_RESET_ALL (947)
- #define DIALOG_PROP_DELETE_ALL (948)
- #define DIALOG_PROP_SET_OWNER (949)
- #define DIALOG_PROP_SET_PRICE (950)
- #define DIALOG_PROP_LIST (951)
- #define DIALOG_PROP_INTERIORES (952)
- #define DIALOG_PROP_EXTORCAO (953)
- enum _PropInfo
- {
- Prop_ID,
- Prop_Nome[64],
- Prop_Dono[MAX_PLAYER_NAME],
- Float:Prop_X,
- Float:Prop_Y,
- Float:Prop_Z,
- bool:Prop_Comprada,
- bool:Prop_IntActived,
- Prop_Valor,
- Prop_Ganhando,
- Prop_InteriorID,
- Prop_Extorcao,
- Prop_AutoSell,
- //NÃO SALVÁVIES
- Prop_Pickup,
- Prop_MapIcon,
- Text3D:PropText
- }
- enum _PropIntInfo
- {
- pIntName[80],
- pID_Int,
- Float:pPositions[4]
- }
- new const _GetIntProps[][_PropIntInfo] = {
- {{"24/7 - 1"}, {17}, {-25.63,-187.06,1003.54,0.97}},
- {{"24/7 - 2"}, {10}, {5.92,-30.63,1003.54,357.19}},
- {{"24/7 - 3"}, {18}, {-30.86,-90.48,1003.54,357.81}},
- {{"24/7 - 4"}, {16}, {-25.89,-139.36,1003.54,2.99}},
- {{"24/7 - 5"}, {4}, {-27.31,-29.27,1003.55,2.99}},
- {{"24/7 - 6"}, {6}, {-27.30,-56.22,1003.54,359.52}},
- {{"Shamal (Nave)"}, {1}, {1.44,23.43,1199.59,354.32}},
- {{"Andromada (Avião)"}, {9}, {315.66,986.72,1958.51,357.79}},
- {{"Loja de Armas - 1"}, {1}, {285.95,-40.73,1001.51,296.66}},
- {{"Loja de Armas - 2"}, {4}, {285.57,-85.25,1001.51,359.96}},
- {{"Loja de Armas - 3"}, {6}, {296.70,-111.21,1001.51,2.80}},
- {{"Loja de Armas - 4"}, {7}, {315.60,-142.50,999.60,4.34}},
- {{"Loja de Armas - 5"}, {6}, {316.52,-167.70,999.59,4.34}},
- {{"Loja de Armas - Cabines"}, {7}, {303.55,-142.13,1004.06,88.01}},
- {{"Loja de Armas - Pista"}, {7}, {298.50,-141.64,1004.05,88.01}},
- {{"Sala de orçamento do motel"}, {12}, {446.56,507.34,1001.41,355.81}},
- {{"Motel Jefferson"}, {15}, {2215.57,-1150.24,1025.79,264.95}},
- {{"Loja de Apostas - Loteria"}, {3}, {833.48,7.50,1004.17,87.77}},
- {{"Sex Shop"}, {3}, {-99.98,-24.04,1000.71,3.31}},
- {{"Fábrica de Carne"}, {1}, {964.39,2108.34,1011.03,90.08}},
- {{"Loja do Zero"}, {6}, {-2239.44,137.10,1035.41,269.43}},
- {{"Porão de Caligula"}, {1}, {2170.55,1618.65,999.97,271.16}},
- {{"Escritório do Woozie"}, {1}, {-2158.66,641.91,1052.37,179.38}},
- {{"Binco (Loja de Roupas)"}, {15}, {207.73,-110.57,1005.13,3.60}},
- {{"Didier Sachs (Loja de Roupas)"}, {14}, {204.33,-166.69,1000.52,3.60}},
- {{"Prolaps (Loja de Roupas)"}, {3}, {207.05,-138.80,1003.50,3.60}},
- {{"Suburban (Loja de Roupas)"}, {1}, {203.77,-48.49,1001.80,1.50}},
- {{"Victim (Loja de Roupas)"}, {5}, {226.49,-7.99,1002.21,84.39}},
- {{"Zip (Loja de Roupas)"}, {18}, {161.52,-95.08,1001.80,357.62}},
- {{"Alhambra"}, {17}, {493.39,-22.72,1000.67,357.62}},
- {{"Bar"}, {11}, {501.98,-69.15,998.75,187.02}},
- {{"Bar Lil' pobre"}, {18}, {-228.54,1401.24,27.76,272.87}},
- {{"Lanchonete do Jay"}, {4}, {458.89,-88.63,999.55,90.99}},
- {{"Mundo de Coq"}, {1}, {446.50,-6.78,1000.73,173.52}},
- {{"Burger shot"}, {10}, {363.79,-74.42,1001.50,314.96}},
- {{"Clucki'n Bell"}, {9}, {365.07,-10.41,1001.85,356.17}},
- {{"Well Stacked Pizza"}, {5}, {372.35,-132.67,1001.49,4.15}},
- {{"Rusty Browns Rosquinhas"}, {17}, {377.13,-192.59,1000.63,0.08}},
- {{"Quarto da Denise"}, {1}, {244.26,304.89,999.14,271.09}},
- {{"Quarto da Katie"}, {2}, {267.77,305.10,999.14,264.03}},
- {{"Quarto da Helena"}, {3}, {292.17,309.97,999.14,93.12}},
- {{"Quarto da Michelle"}, {4}, {302.55,301.86,999.14,2.44}},
- {{"Quarto da Barbara"}, {5}, {322.16,302.79,999.14,5.41}},
- {{"Quarto da Millie"}, {6}, {344.85,305.12,999.14,272.39}},
- {{"Represa Sherman"}, {17}, {-959.53,1952.08,9.00,179.16}},
- {{"Prefeitura LS"}, {3}, {388.89,173.70,1008.38,92.83}},
- {{"Area 51"}, {0}, {223.01,1872.59,13.73,267.50}},
- {{"Academia LS"}, {5}, {772.40,-4.40,1000.72,1.96}},
- {{"Academia SF"}, {6}, {774.21,-48.92,1000.58,1.96}},
- {{"Academia LV"}, {7}, {773.95,-76.71,1000.65,358.51}},
- {{"Casa do CJ"}, {3}, {2496.21,-1693.39,1014.74,179.43}},
- {{"Mansão do Madd Dogg"}, {5}, {1263.19,-785.38,1091.90,272.80}},
- {{"Casa do Ryder"}, {2}, {2455.36,-1705.34,1013.50,24.01}},
- {{"Casa do Sweet"}, {1}, {2525.97,-1679.54,1015.49,270.27}},
- {{"Fábrica de Crack"}, {2}, {2543.44,-1304.13,1025.07,179.74}},
- {{"Rancho Big Spread"}, {3}, {1212.09,-27.03,1000.95,181.62}},
- {{"Fanny Batters"}, {6}, {759.66,1442.55,1102.70,177.38}},
- {{"Clube de Strip"}, {2}, {1204.76,-13.07,1000.92,2.56}},
- {{"Clube de Strip (Sala Particular)"}, {2}, {1204.80,13.89,1000.92,2.56}},
- {{"Bordel"}, {3}, {940.98,-18.30,1000.92,5.23}},
- {{"Bordel dos Trigres"}, {3}, {964.93,-53.08,1001.12,90.29}},
- {{"Cúpula do Prazer"}, {3}, {-2636.23,1406.27,906.46,89.04}},
- {{"Liberty City (Fora)"}, {1}, {-729.27,503.08,1371.97,89.04}},
- {{"Liberty City (Dentro)"}, {1}, {-795.01,491.45,1376.19,359.76}},
- {{"Casa da Gangue"}, {5}, {2351.59,-1180.99,1027.97,87.79}},
- {{"Casa de Crack"}, {5}, {318.73,1115.31,1083.88,357.55}},
- {{"Armazém - 1"}, {1}, {1414.43,4.47,1000.92,125.05}},
- {{"Armazém - 2"}, {18}, {1302.51,-1.78,1001.02,125.05}},
- {{"Garagem do Sweet"}, {0}, {2526.54,-1673.45,14.85,96.20}},
- {{"Casa Luxuosa"}, {12}, {2323.92,-1148.09,1050.71,359.72}},
- {{"Batalha de Controle Remoto"}, {10}, {-973.50,1061.38,1345.67,90.58}},
- {{"Barbearia - 1"}, {2}, {411.54,-22.33,1001.80,355.33}},
- {{"Barbearia - 2"}, {3}, {418.65,-82.63,1001.80,355.33}},
- {{"Barbearia - 3"}, {12}, {412.02,-52.64,1001.89,355.33}},
- {{"Loja de Tatuagens - 1"}, {16}, {-204.43,-26.45,1002.27,355.33}},
- {{"Loja de Tatuagens - 2"}, {17}, {-204.43,-8.46,1002.27,355.33}},
- {{"Loja de Tatuagens - 3"}, {3}, {-204.43,-43.65,1002.27,355.33}},
- {{"DP LS"}, {6}, {246.78,63.90,1003.64,355.33}},
- {{"DP SF"}, {10}, {246.37,109.24,1003.21,355.33}},
- {{"DP LV"}, {3}, {288.74,169.35,1007.17,355.33}},
- {{"Auto Escola"}, {3}, {-2026.99,-104.49,1035.17,177.02}},
- {{"Auto Escola 2"}, {3}, {1494.37,1304.58,1093.28,357.96}},
- {{"Pista de Corrida"}, {7}, {-1398.06,-217.02,1051.11,177.02}},
- {{"Pista de Terra"}, {15}, {-1423.99,932.84,1036.40,354.34}},
- {{"Pista de Rally"}, {4}, {-1430.87,-660.88,1053.01,32.23}},
- {{"Kickstart"}, {14}, {-1464.29,1557.34,1052.53,357.77}},
- {{"Estádio Vice"}, {1}, {-1401.82,107.05,1032.27,357.77}},
- {{"Garagem SF"}, {0}, {-1790.37,1433.84,7.18,354.90}},
- {{"Garagem LS"}, {0}, {1643.30,-1517.71,13.56,358.01}},
- {{"Loja de Bombas SF"}, {0}, {-1691.78,1035.54,45.21,271.21}},
- {{"Armazém Blueberry"}, {0}, {64.96,-298.32,1.57,181.94}},
- {{"Armazém LV"}, {0}, {1058.92,2087.63,10.82,278.73}},
- {{"Armazém LV (Parte oculta)"}, {0}, {1059.18,2148.93,10.82,278.73}},
- {{"Banco"}, {0}, {2306.19,-15.83,26.74,273.67}},
- {{"Shopping LS"}, {18}, {1727.18,-1639.12,20.22,175.60}}
- };
- new PropInfo[MAX_PROPRIEDADES_SERVIDOR][_PropInfo];
- new Propriedades_Criadas, RhayID[MAX_PLAYERS];
- new Prop_List[MAX_PLAYERS][11], TimerProp[MAX_PLAYERS], IntMaxValue[MAX_PLAYERS][3], TimerAutoSellProp;
- public OnFilterScriptInit()
- {
- LoadAll_Property();
- TimerAutoSellProp = SetTimer("FuncAutoSell", 3600000, true);
- return 1;
- }
- public OnFilterScriptExit()
- {
- KillTimer(TimerAutoSellProp);
- for(new i = 0; i < MAX_PROPRIEDADES_SERVIDOR; ++i)
- {
- if(DOF2_FileExists(pProp(i)))
- {
- DestroyDynamicPickup(PropInfo[i][Prop_Pickup]);
- DestroyDynamicMapIcon(PropInfo[i][Prop_MapIcon]);
- DestroyDynamic3DTextLabel(PropInfo[i][PropText]);
- }
- }
- DOF2_Exit();
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- SetPVarInt(playerid, "EnterPropID", -1);
- Prop_List[playerid][10] = -1;
- TimerProp[playerid] = SetTimerEx("Propriedade_Ganhos", MINUTOS_GANHOS_PROP, true, "i", playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- KillTimer(TimerProp[playerid]);
- DeletePVar(playerid, "EnterPropID");
- DeletePVar(playerid, "PropTemp_Nome");
- DeletePVar(playerid, "PropTemp_IntID");
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- DisablePlayerCheckpoint(playerid);
- return 1;
- }
- public OnPlayerSpawn(playerid) return SetPVarInt(playerid, "EnterPropID", -1);
- public OnPlayerDeath(playerid, killerid, reason) return SetPVarInt(playerid, "EnterPropID", -1);
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- new StringGameTextFP[20];
- if(newkeys == KEY_SECONDARY_ATTACK && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
- {
- if(GetPVarInt(playerid, "EnterPropID") >= 0)
- {
- SetPlayerPos(playerid, DOF2_GetFloat(pProp(GetPVarInt(playerid, "EnterPropID")), "Prop_X"), DOF2_GetFloat(pProp(GetPVarInt(playerid, "EnterPropID")), "Prop_Y"), DOF2_GetFloat(pProp(GetPVarInt(playerid, "EnterPropID")), "Prop_Z"));
- SetPlayerInterior(playerid, 0);
- SetPVarInt(playerid, "EnterPropID", -1);
- return 1;
- }
- RhayID[playerid] = IsPlayerNearProperty(playerid);
- if(RhayID[playerid] == -666) return 1;
- if(PropInfo[RhayID[playerid]][Prop_IntActived])
- {
- if(GetPlayerMoney(playerid) < PropInfo[RhayID[playerid]][Prop_Extorcao] && strcmp(PropInfo[RhayID[playerid]][Prop_Dono], pNamer(playerid))) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Você não tem dinheiro suficiente para entrar nesta propriedade.");
- SetPlayerInterior(playerid, _GetIntProps[PropInfo[RhayID[playerid]][Prop_InteriorID]][pID_Int]);
- SetPlayerPos(playerid, _GetIntProps[PropInfo[RhayID[playerid]][Prop_InteriorID]][pPositions][0], _GetIntProps[PropInfo[RhayID[playerid]][Prop_InteriorID]][pPositions][1], _GetIntProps[PropInfo[RhayID[playerid]][Prop_InteriorID]][pPositions][2]);
- SetPlayerFacingAngle(playerid, _GetIntProps[PropInfo[RhayID[playerid]][Prop_InteriorID]][pPositions][3]);
- SetPVarInt(playerid, "EnterPropID", RhayID[playerid]);
- SendClientMessage(playerid, -1, "{00FF00}[INFO]: Pressione '{FF0080}F{00FF00}' ou '{FF0080}Enter{00FF00}' para sair da propriedade.");
- if(PropInfo[RhayID[playerid]][Prop_Extorcao] > 0 && strcmp(PropInfo[RhayID[playerid]][Prop_Dono], pNamer(playerid)))
- {
- format(StringGameTextFP, sizeof(StringGameTextFP), "~r~-R$ %d", PropInfo[RhayID[playerid]][Prop_Extorcao]);
- GameTextForPlayer(playerid, StringGameTextFP, 1000, 1);
- GivePlayerMoney(playerid, -PropInfo[RhayID[playerid]][Prop_Extorcao]);
- }
- }
- else
- {
- if(!IsPlayerAdmin(playerid)) ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_INFOS);
- else ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_ADMIN_HOME);
- }
- }
- if(newkeys == KEY_YES && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
- {
- RhayID[playerid] = IsPlayerNearProperty(playerid);
- if(RhayID[playerid] == -666) return 1;
- if(PropInfo[RhayID[playerid]][Prop_IntActived])
- {
- if(!IsPlayerAdmin(playerid)) ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_INFOS);
- else ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_ADMIN_HOME);
- }
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_PROP_INFOS)
- {
- if(response)
- {
- RhayID[playerid] = IsPlayerNearProperty(playerid);
- if(RhayID[playerid] == -666) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Você não está perto de nenhuma propriedade.");
- if(PropInfo[RhayID[playerid]][Prop_Comprada])
- {
- if(!strcmp(PropInfo[RhayID[playerid]][Prop_Dono], pNamer(playerid)))
- return ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_AJUSTES);
- }
- else
- {
- if(GetPlayerMoney(playerid) < PropInfo[RhayID[playerid]][Prop_Valor]) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Você não tem dinheiro suficiente para comprar esta propriedade!");
- if(ContarMyProps(playerid) >= MAX_PROPRIEDADES_POR_PLAYER) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Você já tem 4 propriedades, e não poderá comprar nenhuma.");
- DOF2_SetString(pProp(RhayID[playerid]), "Prop_Dono", pNamer(playerid));
- DOF2_SetBool(pProp(RhayID[playerid]), "Prop_Comprada", true);
- DOF2_SetInt(pProp(RhayID[playerid]), "Prop_AutoSell", DIAS_AUTO_VENDER);
- GivePlayerMoney(playerid, -PropInfo[RhayID[playerid]][Prop_Valor]);
- CarregarProp(RhayID[playerid]);
- }
- }
- return 1;
- }
- else if(dialogid == DIALOG_PROP_AJUSTES)
- {
- if(response)
- {
- if(!strcmp(PropInfo[RhayID[playerid]][Prop_Dono], pNamer(playerid)))
- {
- RhayID[playerid] = IsPlayerNearProperty(playerid);
- if(RhayID[playerid] == -666) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Você não está perto de nenhuma propriedade.");
- switch(listitem)
- {
- case 0: ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_NOME);
- case 1: ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_VENDER);
- }
- }
- else SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Você não é o dono desta propriedade!");
- }
- return 1;
- }
- else if(dialogid == DIALOG_PROP_NOME)
- {
- RhayID[playerid] = IsPlayerNearProperty(playerid);
- if(RhayID[playerid] == -666) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Você não está perto de nenhuma propriedade.");
- if(response)
- {
- if(!strcmp(PropInfo[RhayID[playerid]][Prop_Dono], pNamer(playerid)) || IsPlayerAdmin(playerid))
- {
- if(strlen(inputtext) > 64 || !strlen(inputtext)) return ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_NOME);
- DOF2_SetString(pProp(RhayID[playerid]), "Prop_Nome", inputtext);
- CarregarProp(RhayID[playerid]);
- if(IsPlayerAdmin(playerid)) return ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_ADMIN_HOME);
- }
- else SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Você não é o dono desta propriedade!");
- }
- else
- {
- if(IsPlayerAdmin(playerid)) return ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_ADMIN_HOME);
- ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_AJUSTES);
- }
- return 1;
- }
- else if(dialogid == DIALOG_PROP_VENDER)
- {
- RhayID[playerid] = IsPlayerNearProperty(playerid);
- if(RhayID[playerid] == -666) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Você não está perto de nenhuma propriedade.");
- if(response)
- {
- if(!strcmp(PropInfo[RhayID[playerid]][Prop_Dono], pNamer(playerid)))
- {
- DOF2_SetString(pProp(RhayID[playerid]), "Prop_Dono", "Ninguém");
- DOF2_SetBool(pProp(RhayID[playerid]), "Prop_Comprada", false);
- DOF2_SetInt(pProp(RhayID[playerid]), "Prop_AutoSell", DIAS_AUTO_VENDER);
- GivePlayerMoney(playerid, PropInfo[RhayID[playerid]][Prop_Valor]/2);
- CarregarProp(RhayID[playerid]);
- }
- else SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Você não é o dono desta propriedade!");
- }
- else ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_AJUSTES);
- return 1;
- }
- else if(dialogid == DIALOG_PROP_ADMIN_HOME)
- {
- if(response)
- {
- RhayID[playerid] = IsPlayerNearProperty(playerid);
- if(!IsPlayerAdmin(playerid)) return 1;
- switch(listitem)
- {
- case 0: //Criar uma nova propriedade
- {
- if(RhayID[playerid] != -666) return ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_ADMIN_HOME);
- ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_NEW_NOME);
- }
- case 1: //Resetar todas as propriedades
- {
- if(RhayID[playerid] != -666) return ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_ADMIN_HOME);
- ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_RESET_ALL);
- }
- case 2: //Excluir todas as propriedades
- {
- if(RhayID[playerid] != -666) return ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_ADMIN_HOME);
- ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_DELETE_ALL);
- }
- case 3: //Excluir Propriedade (Atual)
- {
- if(!IsPlayerAdmin(playerid)) return 1;
- if(RhayID[playerid] == -666) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Você não está perto de nenhuma propriedade.");
- Deletar_Propriedade(RhayID[playerid]);
- SendClientMessage(playerid, 0x00FF00FF, "[INFO]: Propriedade removida com sucesso.");
- }
- case 4: //Resetar Propriedade (Atual)
- {
- if(!IsPlayerAdmin(playerid)) return 1;
- if(RhayID[playerid] == -666) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Você não está perto de nenhuma propriedade.");
- DOF2_SetString(pProp(RhayID[playerid]), "Prop_Dono", "Ninguém");
- DOF2_SetBool(pProp(RhayID[playerid]), "Prop_Comprada", false);
- DOF2_SetBool(pProp(RhayID[playerid]), "Prop_IntActived", false);
- DOF2_SetInt(pProp(RhayID[playerid]), "Prop_Extorcao", 0);
- DOF2_SetInt(pProp(RhayID[playerid]), "Prop_InteriorID", -1);
- DOF2_SetInt(pProp(RhayID[playerid]), "Prop_AutoSell", DIAS_AUTO_VENDER);
- CarregarProp(RhayID[playerid]);
- SendClientMessage(playerid, 0x00FF00FF, "[INFO]: Propriedade resetada com sucesso.");
- }
- case 5: //Nome da Propriedade (Atual)
- {
- if(!IsPlayerAdmin(playerid)) return 1;
- if(RhayID[playerid] == -666) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Você não está perto de nenhuma propriedade.");
- ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_NOME);
- }
- case 6: //Dono da Propriedade (Atual)
- {
- if(!IsPlayerAdmin(playerid)) return 1;
- if(RhayID[playerid] == -666) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Você não está perto de nenhuma propriedade.");
- ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_SET_OWNER);
- }
- case 7: //Preço da Propriedade (Atual)
- {
- if(!IsPlayerAdmin(playerid)) return 1;
- if(RhayID[playerid] == -666) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Você não está perto de nenhuma propriedade.");
- ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_SET_PRICE);
- }
- case 8: //Definir ou Modificar interior da Propriedade (Atual)
- {
- if(RhayID[playerid] == -666) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Você não está perto de nenhuma propriedade!");
- IntMaxValue[playerid][2] = 0;
- CallViewListInts(playerid);
- }
- case 9: //Desabilitar Interior (Atual)
- {
- if(RhayID[playerid] == -666) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Você não está perto de nenhuma propriedade!");
- DOF2_SetBool(pProp(RhayID[playerid]), "Prop_IntActived", false);
- DOF2_SetInt(pProp(RhayID[playerid]), "Prop_Extorcao", 0);
- DOF2_SetInt(pProp(RhayID[playerid]), "Prop_InteriorID", -1);
- CarregarProp(RhayID[playerid]);
- SendClientMessage(playerid, 0x00FF00FF, "[INFO]: Interior desabilitado com sucesso.");
- }
- }
- }
- return 1;
- }
- else if(dialogid == DIALOG_PROP_NEW_NOME)
- {
- RhayID[playerid] = IsPlayerNearProperty(playerid);
- if(!IsPlayerAdmin(playerid)) return 1;
- if(response)
- {
- if(RhayID[playerid] != -666) return ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_ADMIN_HOME);
- if(strlen(inputtext) > 64) return ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_NEW_NOME);
- if(!strlen(inputtext)) SetPVarString(playerid, "PropTemp_Nome", "Sem nome");
- else SetPVarString(playerid, "PropTemp_Nome", inputtext);
- ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_NEW_PRECO);
- }
- return 1;
- }
- else if(dialogid == DIALOG_PROP_NEW_PRECO)
- {
- new StringPVar[65], Float:PVarPosition[3];
- RhayID[playerid] = IsPlayerNearProperty(playerid);
- if(!IsPlayerAdmin(playerid)) return 1;
- if(response)
- {
- if(RhayID[playerid] != -666) return ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_ADMIN_HOME);
- if(strval(inputtext) < 100 || strval(inputtext) > 10000000 || !strlen(inputtext)) return ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_NEW_PRECO);
- GetPlayerPos(playerid, PVarPosition[0], PVarPosition[1], PVarPosition[2]);
- GetPVarString(playerid, "PropTemp_Nome", StringPVar, sizeof(StringPVar));
- Criar_Propriedade(StringPVar, "Ninguém", PVarPosition[0], PVarPosition[1], PVarPosition[2], false, strval(inputtext));
- }
- return 1;
- }
- else if(dialogid == DIALOG_PROP_RESET_ALL)
- {
- if(!IsPlayerAdmin(playerid)) return 1;
- RhayID[playerid] = IsPlayerNearProperty(playerid);
- if(RhayID[playerid] != -666) return ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_ADMIN_HOME);
- if(response)
- {
- ResetAll_Property();
- SendClientMessage(playerid, 0x00FF00FF, "[INFO]: Todas as propriedades foram resetadas com sucesso.");
- }
- else ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_ADMIN_HOME);
- return 1;
- }
- else if(dialogid == DIALOG_PROP_DELETE_ALL)
- {
- if(!IsPlayerAdmin(playerid)) return 1;
- RhayID[playerid] = IsPlayerNearProperty(playerid);
- if(RhayID[playerid] != -666) return ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_ADMIN_HOME);
- if(response)
- {
- ResetAll_Property(true); //Remover
- SendClientMessage(playerid, 0x00FF00FF, "[INFO]: Todas as propriedades foram excluídas com sucesso.");
- }
- else ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_ADMIN_HOME);
- return 1;
- }
- else if(dialogid == DIALOG_PROP_SET_OWNER)
- {
- new StringOwnerDialog[128];
- if(!IsPlayerAdmin(playerid)) return 1;
- RhayID[playerid] = IsPlayerNearProperty(playerid);
- if(response)
- {
- if(strval(inputtext) < 0 || strval(inputtext) > MAX_PLAYERS || !strlen(inputtext)) return ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_SET_OWNER);
- if(!IsPlayerConnected(strval(inputtext)))
- {
- SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Jogador não conectado.");
- ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_SET_OWNER);
- return 1;
- }
- if(ContarMyProps(strval(inputtext)) >= MAX_PROPRIEDADES_POR_PLAYER)
- {
- format(StringOwnerDialog, sizeof(StringOwnerDialog), "[ERRO]: O jogador {FFFF00}%s {FF0000}já possui {FF8000}%d {FF0000}propriedades.", pNamer(strval(inputtext)), MAX_PROPRIEDADES_POR_PLAYER);
- SendClientMessage(playerid, 0xFF0000FF, StringOwnerDialog);
- ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_SET_OWNER);
- return 1;
- }
- DOF2_SetString(pProp(RhayID[playerid]), "Prop_Dono", pNamer(strval(inputtext)));
- DOF2_SetBool(pProp(RhayID[playerid]), "Prop_Comprada", true);
- DOF2_SetInt(pProp(RhayID[playerid]), "Prop_AutoSell", DIAS_AUTO_VENDER);
- CarregarProp(RhayID[playerid]);
- format(StringOwnerDialog, sizeof(StringOwnerDialog), "{FF8000}[!] O administrador {FFFF00}%s {FF8000}te deu a propriedade de {00FFFF}ID %d{FF8000}, aproveite!", pNamer(playerid), RhayID[playerid]);
- SendClientMessage(strval(inputtext), 0xFF0000FF, StringOwnerDialog);
- }
- else ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_ADMIN_HOME);
- return 1;
- }
- else if(dialogid == DIALOG_PROP_SET_PRICE)
- {
- if(response)
- {
- if(!IsPlayerAdmin(playerid)) return 1;
- RhayID[playerid] = IsPlayerNearProperty(playerid);
- if(strval(inputtext) < 100 || strval(inputtext) > 10000000 || !strlen(inputtext)) return ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_SET_PRICE);
- DOF2_SetInt(pProp(RhayID[playerid]), "Prop_Valor", strval(inputtext));
- DOF2_SetInt(pProp(RhayID[playerid]), "Prop_Ganhando", strval(inputtext) / 10);
- CarregarProp(RhayID[playerid]);
- SendClientMessage(playerid, 0x00FF00FF, "[INFO]: Preço da propriedade redefinido com sucesso.");
- }
- else ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_ADMIN_HOME);
- return 1;
- }
- else if(dialogid == DIALOG_PROP_LIST)
- {
- if(response)
- {
- switch(listitem)
- {
- case 0 .. 9:
- {
- if(DOF2_FileExists(pProp(Prop_List[playerid][listitem])))
- {
- if(IsPlayerAdmin(playerid)) SetPlayerPos(playerid, DOF2_GetFloat(pProp(Prop_List[playerid][listitem]), "Prop_X"), DOF2_GetFloat(pProp(Prop_List[playerid][listitem]), "Prop_Y"), DOF2_GetFloat(pProp(Prop_List[playerid][listitem]), "Prop_Z"));
- else SetPlayerCheckpoint(playerid, DOF2_GetFloat(pProp(Prop_List[playerid][listitem]), "Prop_X"), DOF2_GetFloat(pProp(Prop_List[playerid][listitem]), "Prop_Y"), DOF2_GetFloat(pProp(Prop_List[playerid][listitem]), "Prop_Z"), 3.0);
- }
- }
- case 10:
- {
- if(Prop_List[playerid][10] > 0) ViewListProps(playerid);
- }
- }
- }
- return 1;
- }
- else if(dialogid == DIALOG_PROP_INTERIORES)
- {
- RhayID[playerid] = IsPlayerNearProperty(playerid);
- if(RhayID[playerid] == -666 || !IsPlayerAdmin(playerid)) return 1;
- if(response)
- {
- switch(listitem)
- {
- case 0 .. 9:
- {
- SetPVarInt(playerid, "PropTemp_IntID", IntMaxValue[playerid][0]+listitem);
- ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_EXTORCAO);
- }
- case 10:
- {
- IntMaxValue[playerid][2]++; //Next
- CallViewListInts(playerid);
- }
- }
- }
- else //Cancelar ou Voltar
- {
- if(IntMaxValue[playerid][2] > 0) //Se o jogador estiver na página 1 ou mais...
- {
- IntMaxValue[playerid][2]--; //Back
- CallViewListInts(playerid);
- }
- else ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_ADMIN_HOME);
- }
- return 1;
- }
- if(dialogid == DIALOG_PROP_EXTORCAO)
- {
- RhayID[playerid] = IsPlayerNearProperty(playerid);
- if(RhayID[playerid] == -666 || !IsPlayerAdmin(playerid)) return 1;
- if(response)
- {
- if(!strlen(inputtext) || strval(inputtext) <= 0) DOF2_SetInt(pProp(RhayID[playerid]), "Prop_Extorcao", 0);
- else
- {
- if(strval(inputtext) > DOF2_GetInt(pProp(RhayID[playerid]), "Prop_Valor")/2)
- {
- SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Valor máximo de extorção atingido, digite uma quantia válida.");
- ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_EXTORCAO);
- }
- else DOF2_SetInt(pProp(RhayID[playerid]), "Prop_Extorcao", strval(inputtext));
- }
- DOF2_SetInt(pProp(RhayID[playerid]), "Prop_InteriorID", GetPVarInt(playerid, "PropTemp_IntID"));
- DOF2_SetBool(pProp(RhayID[playerid]), "Prop_IntActived", true);
- CarregarProp(RhayID[playerid]);
- }
- else
- {
- ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_ADMIN_HOME);
- }
- return 1;
- }
- return 0;
- }
- stock ShowDialogProps(playerid, PropID, DialogID)
- {
- new DialogInfosProp[500], StrCatMotherFuck[100];
- Contar_Propriedades();
- switch(DialogID)
- {
- case DIALOG_PROP_INFOS:
- {
- if(PropInfo[PropID][Prop_IntActived] && PropInfo[PropID][Prop_Extorcao] > 0)
- {
- format(DialogInfosProp, sizeof(DialogInfosProp), "{408080}ID da Propriedade: {00FFFF}%d\n{408080}Nome da Propriedade: {FF8000}%s\n{408080}Dono da Propriedade: {FFFF00}%s\n{408080}Preço da Propriedade: {00FF00}R$ %d\n{408080}Ganhos da Propriedade: {009300}R$ %d\n{408080}Extorção de entrada: {FF0000}R$ %d", PropInfo[PropID][Prop_ID], PropInfo[PropID][Prop_Nome], PropInfo[PropID][Prop_Dono], PropInfo[PropID][Prop_Valor], PropInfo[PropID][Prop_Ganhando], PropInfo[PropID][Prop_Extorcao]);
- }
- else format(DialogInfosProp, sizeof(DialogInfosProp), "{408080}ID da Propriedade: {00FFFF}%d\n{408080}Nome da Propriedade: {FF8000}%s\n{408080}Dono da Propriedade: {FFFF00}%s\n{408080}Preço da Propriedade: {00FF00}R$ %d\n{408080}Ganhos da Propriedade: {009300}R$ %d", PropInfo[PropID][Prop_ID], PropInfo[PropID][Prop_Nome], PropInfo[PropID][Prop_Dono], PropInfo[PropID][Prop_Valor], PropInfo[PropID][Prop_Ganhando]);
- if(PropInfo[PropID][Prop_Comprada])
- {
- if(!strcmp(PropInfo[PropID][Prop_Dono], pNamer(playerid))) ShowPlayerDialog(playerid, DIALOG_PROP_INFOS, DIALOG_STYLE_MSGBOX, "Informações", DialogInfosProp, "Opções", "Fechar");
- else ShowPlayerDialog(playerid, DIALOG_PROP_INFOS, DIALOG_STYLE_MSGBOX, "Informações", DialogInfosProp, "Fechar", "");
- }
- else ShowPlayerDialog(playerid, DIALOG_PROP_INFOS, DIALOG_STYLE_MSGBOX, "Informações", DialogInfosProp, "Comprar", "Fechar");
- }
- case DIALOG_PROP_AJUSTES:
- {
- if(!strcmp(PropInfo[PropID][Prop_Dono], pNamer(playerid)))
- {
- format(DialogInfosProp, sizeof(DialogInfosProp), "{00FFFF}Nome ({FF8000}%s{00FFFF})\n{FF0080}Vender Propriedade ({00FF00}R$ %d{FF0080})", DOF2_GetString(pProp(PropID), "Prop_Nome"), DOF2_GetInt(pProp(PropID), "Prop_Valor")/2);
- ShowPlayerDialog(playerid, DIALOG_PROP_AJUSTES, DIALOG_STYLE_LIST, "Opções", DialogInfosProp, "Confirmar", "Cancelar");
- }
- }
- case DIALOG_PROP_NOME:
- {
- format(DialogInfosProp, sizeof(DialogInfosProp), "{C0C0C0}'{FFFF00}%s{C0C0C0}'\n\n{8080FF}Digite abaixo o nome da propriedade desejado:", PropInfo[PropID][Prop_Nome]);
- if(!strcmp(PropInfo[PropID][Prop_Dono], pNamer(playerid)) || IsPlayerAdmin(playerid))
- return ShowPlayerDialog(playerid, DIALOG_PROP_NOME, DIALOG_STYLE_INPUT, "Nome da propriedade", DialogInfosProp, "Confirmar", "Cancelar");
- }
- case DIALOG_PROP_VENDER:
- {
- format(DialogInfosProp, sizeof(DialogInfosProp), "{8080FF}Tem certeza que quer vender a propriedade de {00FFFF}ID %d {8080FF}por {00FF00}R$ %d{8080FF}?", PropID, PropInfo[PropID][Prop_Valor]/2);
- if(!strcmp(PropInfo[PropID][Prop_Dono], pNamer(playerid)))
- return ShowPlayerDialog(playerid, DIALOG_PROP_VENDER, DIALOG_STYLE_MSGBOX, "Vender Propriedade", DialogInfosProp, "Vender", "Cancelar");
- }
- //ADMIN
- case DIALOG_PROP_ADMIN_HOME:
- {
- if(!IsPlayerAdmin(playerid)) return 1;
- if(PropID == -666)
- {
- if(Propriedades_Criadas > 0) format(DialogInfosProp, sizeof(DialogInfosProp), "{00FF00}Criar Propriedade {8080FF}[ID: %d]\n{FF8000}Resetar Propriedades {8080FF}[All(%d)]\n{FF0080}Deletar Propriedades {8080FF}[All(%d)]", GetCurrentPropID(), Propriedades_Criadas, Propriedades_Criadas);
- else format(DialogInfosProp, sizeof(DialogInfosProp), "{00FF00}Criar Propriedade {8080FF}[ID: %d]", GetCurrentPropID());
- }
- else
- {
- format(DialogInfosProp, sizeof(DialogInfosProp), "{C0C0C0}Criar Propriedade [ID: %d]\n{C0C0C0}Resetar Propriedades [All(%d)]\n{C0C0C0}Deletar Propriedades [All(%d)]\n{FF0000}Deletar Propriedade {8080FF}[ID: %d]\n{FF8000}Resetar Propriedade {8080FF}[ID: %d]\n{FFFF00}Nome da Propriedade {8080FF}[ID: %d]\n{FF0080}Dono da Propriedade {8080FF}[ID: %d]\n{00FF00}Preço da Propriedade {8080FF}[ID: %d]", GetCurrentPropID(), Propriedades_Criadas, Propriedades_Criadas, PropID, PropID, PropID, PropID, PropID);
- if(PropInfo[PropID][Prop_IntActived]) format(StrCatMotherFuck, sizeof(StrCatMotherFuck), "\n{FF80C0}Interior {8080FF}(%s)\n{A40000}Desabilitar Interior {8080FF}[ID: %d]", _GetIntProps[PropInfo[PropID][Prop_InteriorID]][pIntName], PropID);
- else format(StrCatMotherFuck, sizeof(StrCatMotherFuck), "\n{FF80C0}Definir Interior {8080FF}[ID: %d]", PropID);
- strcat(DialogInfosProp, StrCatMotherFuck);
- }
- ShowPlayerDialog(playerid, DIALOG_PROP_ADMIN_HOME, DIALOG_STYLE_LIST, "rProperties", DialogInfosProp, "Confirmar", "Cancelar");
- }
- case DIALOG_PROP_NEW_NOME: ShowPlayerDialog(playerid, DIALOG_PROP_NEW_NOME, DIALOG_STYLE_INPUT, "[NEW] Nome da Propriedade", "{8080FF}Digite abaixo o nome desejado para a nova propriedade:", "Confirmar", "Cancelar");
- case DIALOG_PROP_NEW_PRECO: ShowPlayerDialog(playerid, DIALOG_PROP_NEW_PRECO, DIALOG_STYLE_INPUT, "[NEW] Preço da Propriedade", "{8080FF}Digite abaixo o preço da nova propriedade:\n{C0C0C0}(Mínimo: 100 | Máximo: 10000000)", "Confirmar", "Cancelar");
- case DIALOG_PROP_RESET_ALL:
- {
- format(DialogInfosProp, sizeof(DialogInfosProp), "{8080FF}Tem certeza que quer resetar todas propriedades do servidor? {C0C0C0}(%d)", Propriedades_Criadas);
- ShowPlayerDialog(playerid, DIALOG_PROP_RESET_ALL, DIALOG_STYLE_MSGBOX, "Resetar propriedades", DialogInfosProp, "Resetar", "Cancelar");
- }
- case DIALOG_PROP_DELETE_ALL:
- {
- format(DialogInfosProp, sizeof(DialogInfosProp), "{8080FF}Tem certeza que quer {FF0000}deletar {8080FF}todas propriedades do servidor? {C0C0C0}(%d)", Propriedades_Criadas);
- ShowPlayerDialog(playerid, DIALOG_PROP_DELETE_ALL, DIALOG_STYLE_MSGBOX, "Deletar propriedades", DialogInfosProp, "Resetar", "Cancelar");
- }
- case DIALOG_PROP_SET_OWNER:
- {
- ShowPlayerDialog(playerid, DIALOG_PROP_SET_OWNER, DIALOG_STYLE_INPUT, "Dono da propriedade", "{8080FF}Digite abaixo o {FF8000}ID do jogador {8080FF}que será o novo dono da propriedade:", "Confirmar", "Cancelar");
- }
- case DIALOG_PROP_SET_PRICE:
- {
- format(DialogInfosProp, sizeof(DialogInfosProp), "{8080FF}Preço atual: {00FF00}R$ %d\n\n{8080FF}Digite abaixo o preço da propriedade:\n{C0C0C0}(Mínimo: 100 | Máximo: 10000000)", DOF2_GetInt(pProp(PropID), "Prop_Valor"));
- ShowPlayerDialog(playerid, DIALOG_PROP_SET_PRICE, DIALOG_STYLE_INPUT, "Definir preço da propriedade", DialogInfosProp, "Confirmar", "Cancelar");
- }
- case DIALOG_PROP_EXTORCAO:
- {
- format(DialogInfosProp, sizeof(DialogInfosProp), "{8080FF}Digite abaixo o valor de extorção da propriedade:\n{8080FF}Máximo: {00FF00}R$ %d\n\n{C0C0C0}(Caso digitar 0 ou deixar em branco, não será cobrado extorção)", DOF2_GetInt(pProp(PropID), "Prop_Valor")/2);
- ShowPlayerDialog(playerid, DIALOG_PROP_EXTORCAO, DIALOG_STYLE_INPUT, "Extorção da Propriedade", DialogInfosProp, "Confirmar", "Cancelar");
- }
- }
- return 1;
- }
- stock pNamer(playerid)
- {
- new NamePlayerPropH[MAX_PLAYER_NAME];
- GetPlayerName(playerid, NamePlayerPropH, sizeof(NamePlayerPropH));
- return NamePlayerPropH;
- }
- stock ResetAll_Property(bool:DeleteProperty=false) //Resetar todas as propriedades, ou seja, deixar todas à venda novamente.
- {
- Contar_Propriedades();
- for(new i = 0; i < MAX_PROPRIEDADES_SERVIDOR; ++i)
- {
- if(DOF2_FileExists(pProp(i)))
- {
- if(!DeleteProperty)
- {
- DOF2_SetString(pProp(i), "Prop_Dono", "Ninguém");
- DOF2_SetBool(pProp(i), "Prop_Comprada", false);
- DOF2_SetBool(pProp(i), "Prop_IntActived", false);
- DOF2_SetInt(pProp(i), "Prop_Extorcao", 0);
- DOF2_SetInt(pProp(i), "Prop_InteriorID", -1);
- DOF2_SetInt(pProp(i), "Prop_AutoSell", DIAS_AUTO_VENDER);
- CarregarProp(i);
- }
- else Deletar_Propriedade(i);
- }
- }
- return 1;
- }
- stock ViewListProps(playerid)
- {
- new uYuString[800], MotherFuck[128];
- for(new i = Prop_List[playerid][10], c = -1; i < MAX_PROPRIEDADES_SERVIDOR; ++i)
- {
- Prop_List[playerid][c + 1] = -1;
- if(c < 9)
- {
- if(DOF2_FileExists(pProp(i)))
- {
- Prop_List[playerid][++c] = i;
- if(PropInfo[i][Prop_Comprada])
- {
- if(!strcmp(DOF2_GetString(pProp(i), "Prop_Dono"), pNamer(playerid))) format(MotherFuck, sizeof(MotherFuck), "{FF8000}%s {0080C0}[ID %d]: {00FF00}R$ %d {FFFF6C}(Sua propriedade)\n", PropInfo[i][Prop_Nome], i, PropInfo[i][Prop_Valor]);
- else format(MotherFuck, sizeof(MotherFuck), "{FF8000}%s {0080C0}[ID %d]: {00FF00}R$ %d {FF4A4A}(Vendida)\n", PropInfo[i][Prop_Nome], i, PropInfo[i][Prop_Valor]);
- }
- else format(MotherFuck, sizeof(MotherFuck), "{FF8000}%s {0080C0}[ID %d]: {00FF00}R$ %d\n", PropInfo[i][Prop_Nome], i, PropInfo[i][Prop_Valor]);
- strcat(uYuString, MotherFuck);
- }
- }
- else
- {
- if(DOF2_FileExists(pProp(i)))
- {
- Prop_List[playerid][++c] = i;
- strcat(uYuString, "{FF0080}Próximo >>\n");
- break;
- }
- }
- }
- ShowPlayerDialog(playerid, DIALOG_PROP_LIST, DIALOG_STYLE_LIST, "Propriedades", uYuString, "Ok", "Cancelar");
- return 1;
- }
- stock LoadAll_Property() //Carregar todas as propriedades
- {
- Contar_Propriedades();
- static Propriedades_Compradas;
- for(new i = 0; i < MAX_PROPRIEDADES_SERVIDOR; ++i)
- {
- CarregarProp(i);
- if(PropInfo[i][Prop_Comprada]) Propriedades_Compradas++;
- }
- print("\n|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=->");
- printf("| Propriedades Criadas: %d", Propriedades_Criadas);
- printf("| Propriedades Compradas: %d", Propriedades_Compradas);
- printf("| Máximo de Propriedades: %d", MAX_PROPRIEDADES_SERVIDOR);
- printf("| Quantidade que poderá criar: %d", MAX_PROPRIEDADES_SERVIDOR - Propriedades_Criadas);
- print("|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=->\n");
- return 1;
- }
- stock GetCurrentPropID()
- {
- Contar_Propriedades();
- new CurrentPropID = -666;
- for(new i = 0; i < MAX_PROPRIEDADES_SERVIDOR; ++i)
- {
- if(!DOF2_FileExists(pProp(i)))
- {
- CurrentPropID = i;
- break;
- }
- }
- if(CurrentPropID == -666) CurrentPropID = Propriedades_Criadas;
- return CurrentPropID;
- }
- stock Criar_Propriedade(_pNome[], _pDono[], Float:_pX, Float:_pY, Float:_pZ, bool:_pComprada, _pValor, bool:_pIntActived=false, _pIntID=-1, _pExtorcao=0, _pGanhando=-1)
- {
- new CurrentID = GetCurrentPropID();
- if(DOF2_FileExists(pProp(CurrentID))) return 0;
- DOF2_CreateFile(pProp(CurrentID));
- DOF2_SetInt(pProp(CurrentID), "Prop_ID", CurrentID);
- DOF2_SetString(pProp(CurrentID), "Prop_Nome", _pNome); //Nome da Propriedade
- DOF2_SetString(pProp(CurrentID), "Prop_Dono", _pDono); //Dono da Propriedade
- DOF2_SetFloat(pProp(CurrentID), "Prop_X", _pX); //Posição X da Propriedade
- DOF2_SetFloat(pProp(CurrentID), "Prop_Y", _pY); //Posição Y da Propriedade
- DOF2_SetFloat(pProp(CurrentID), "Prop_Z", _pZ); //Posição Z da Propriedade
- DOF2_SetBool(pProp(CurrentID), "Prop_Comprada", _pComprada); //Se a Propriedade está comprada, ou não.
- DOF2_SetBool(pProp(CurrentID), "Prop_IntActived", _pIntActived); //Se a Propriedade é entrável ou não.
- DOF2_SetInt(pProp(CurrentID), "Prop_Valor", _pValor);
- //Caso isto seja escolhido, irá auto-calcular o valor de ganho da propriedade, ou seja, 10% do valor original.
- if(_pGanhando == -1) DOF2_SetInt(pProp(CurrentID), "Prop_Ganhando", _pValor / 10);
- else DOF2_SetInt(pProp(CurrentID), "Prop_Ganhando", _pGanhando);
- DOF2_SetInt(pProp(CurrentID), "Prop_InteriorID", _pIntID);
- DOF2_SetInt(pProp(CurrentID), "Prop_Extorcao", _pExtorcao);
- DOF2_SetInt(pProp(CurrentID), "Prop_AutoSell", DIAS_AUTO_VENDER);
- DOF2_SaveFile();
- CarregarProp(CurrentID);
- if(CurrentID == Propriedades_Criadas) Propriedades_Criadas++;
- return 1;
- }
- stock Deletar_Propriedade(PropID)
- {
- if(!DOF2_FileExists(pProp(PropID))) return 0;
- DestroyDynamicPickup(PropInfo[PropID][Prop_Pickup]);
- DestroyDynamicMapIcon(PropInfo[PropID][Prop_MapIcon]);
- DestroyDynamic3DTextLabel(PropInfo[PropID][PropText]);
- DOF2_RemoveFile(pProp(PropID));
- if(PropID == Propriedades_Criadas)
- Propriedades_Criadas--;
- return 1;
- }
- stock pProp(PropID)
- {
- new Prop_String[30];
- format(Prop_String, sizeof(Prop_String), FOLDER_PROPRIEDADES, PropID);
- return Prop_String;
- }
- stock ContarMyProps(playerid)
- {
- new MyProps;
- for(new i = 0; i < MAX_PROPRIEDADES_SERVIDOR; ++i)
- {
- if(DOF2_FileExists(pProp(i)))
- {
- if(!strcmp(DOF2_GetString(pProp(i), "Prop_Dono"), pNamer(playerid))) MyProps++;
- }
- }
- return MyProps;
- }
- stock Contar_Propriedades()
- {
- Propriedades_Criadas = 0;
- for(new i = 0; i < MAX_PROPRIEDADES_SERVIDOR; ++i)
- {
- if(DOF2_FileExists(pProp(i)))
- {
- Propriedades_Criadas++;
- }
- }
- return 1;
- }
- stock CarregarProp(PropID)
- {
- new PropriedadeTextStr[350];
- PropInfo[PropID][Prop_ID] = DOF2_GetInt(pProp(PropID), "Prop_ID"); //ID da Propriedade!
- format(PropInfo[PropID][Prop_Nome], 64, "%s", DOF2_GetString(pProp(PropID), "Prop_Nome")); //Nome da Propriedade
- format(PropInfo[PropID][Prop_Dono], MAX_PLAYER_NAME, "%s", DOF2_GetString(pProp(PropID), "Prop_Dono")); //Dono da Propriedade
- PropInfo[PropID][Prop_X] = DOF2_GetFloat(pProp(PropID), "Prop_X"); //Posição X da Propriedade
- PropInfo[PropID][Prop_Y] = DOF2_GetFloat(pProp(PropID), "Prop_Y"); //Posição Y da Propriedade
- PropInfo[PropID][Prop_Z] = DOF2_GetFloat(pProp(PropID), "Prop_Z"); //Posição Z da Propriedade
- PropInfo[PropID][Prop_Comprada] = DOF2_GetBool(pProp(PropID), "Prop_Comprada"); //Se a Propriedade está comprada, ou não.
- PropInfo[PropID][Prop_IntActived] = DOF2_GetBool(pProp(PropID), "Prop_IntActived"); //Se a Propriedade é entrável ou não.
- PropInfo[PropID][Prop_Valor] = DOF2_GetInt(pProp(PropID), "Prop_Valor"); //Valor da Propriedade (Dinheiro preciso para comprá-la)
- PropInfo[PropID][Prop_Ganhando] = DOF2_GetInt(pProp(PropID), "Prop_Ganhando"); //10% do Valor acima - isso seria quanto o jogador irá ganhar a cada 30 minutos.
- PropInfo[PropID][Prop_InteriorID] = DOF2_GetInt(pProp(PropID), "Prop_InteriorID"); //ID do Interior da Propriedade
- PropInfo[PropID][Prop_Extorcao] = DOF2_GetInt(pProp(PropID), "Prop_Extorcao");
- PropInfo[PropID][Prop_AutoSell] = DOF2_GetInt(pProp(PropID), "Prop_AutoSell");
- DestroyDynamicPickup(PropInfo[PropID][Prop_Pickup]);
- DestroyDynamicMapIcon(PropInfo[PropID][Prop_MapIcon]);
- DestroyDynamic3DTextLabel(PropInfo[PropID][PropText]);
- if(PropInfo[PropID][Prop_IntActived])
- {
- if(PropInfo[PropID][Prop_Extorcao] <= 0) format(PropriedadeTextStr, sizeof(PropriedadeTextStr), "{FADD00}ID: {FFFFFF}%d\n{FADD00}Nome da Propriedade: {FFFFFF}%s\n{FADD00}Dono da Propriedade: {FFFFFF}%s\n{FADD00}Preço: {00FF00}R$ %d\n{26C2FF}Pressione '{FF8000}Y{26C2FF}' para mais informações\n{26C2FF}Pressione '{FF8000}F{26C2FF}' ou '{FF8000}Enter{26C2FF}' para entrar", PropID, PropInfo[PropID][Prop_Nome], PropInfo[PropID][Prop_Dono], PropInfo[PropID][Prop_Valor]);
- else format(PropriedadeTextStr, sizeof(PropriedadeTextStr), "{FADD00}ID: {FFFFFF}%d\n{FADD00}Nome da Propriedade: {FFFFFF}%s\n{FADD00}Dono da Propriedade: {FFFFFF}%s\n{FADD00}Preço: {00FF00}R$ %d\n{FADD00}Extorção: {FF0000}R$ %d\n{26C2FF}Pressione '{FF8000}Y{26C2FF}' para mais informações\n{26C2FF}Pressione '{FF8000}F{26C2FF}' ou '{FF8000}Enter{26C2FF}' para entrar", PropID, PropInfo[PropID][Prop_Nome], PropInfo[PropID][Prop_Dono], PropInfo[PropID][Prop_Valor], PropInfo[PropID][Prop_Extorcao]);
- }
- else
- {
- format(PropriedadeTextStr, sizeof(PropriedadeTextStr), "{FADD00}ID: {FFFFFF}%d\n{FADD00}Nome da Propriedade: {FFFFFF}%s\n{FADD00}Dono da Propriedade: {FFFFFF}%s\n{FADD00}Preço: {00FF00}R$ %d\n{26C2FF}Pressione '{FF8000}F{26C2FF}' ou '{FF8000}Enter{26C2FF}' para mais informações", PropID, PropInfo[PropID][Prop_Nome], PropInfo[PropID][Prop_Dono], PropInfo[PropID][Prop_Valor]);
- }
- PropInfo[PropID][PropText] = CreateDynamic3DTextLabel(PropriedadeTextStr, 0xFFFFFFAA, PropInfo[PropID][Prop_X], PropInfo[PropID][Prop_Y], PropInfo[PropID][Prop_Z]+1, 7);
- if(PropInfo[PropID][Prop_Comprada]) //Se a propriedade for comprada...
- {
- PropInfo[PropID][Prop_Pickup] = CreateDynamicPickup(PICKUP_PROP_COMPRADA, 1, PropInfo[PropID][Prop_X], PropInfo[PropID][Prop_Y], PropInfo[PropID][Prop_Z]);
- PropInfo[PropID][Prop_MapIcon] = CreateDynamicMapIcon(PropInfo[PropID][Prop_X], PropInfo[PropID][Prop_Y], PropInfo[PropID][Prop_Z], ICONE_PROP_COMPRADA, -1);
- }
- else //Se a propriedade não estiver comprada...
- {
- PropInfo[PropID][Prop_Pickup] = CreateDynamicPickup(PICKUP_PROP_NORMAL, 1, PropInfo[PropID][Prop_X], PropInfo[PropID][Prop_Y], PropInfo[PropID][Prop_Z]);
- PropInfo[PropID][Prop_MapIcon] = CreateDynamicMapIcon(PropInfo[PropID][Prop_X], PropInfo[PropID][Prop_Y], PropInfo[PropID][Prop_Z], ICONE_PROP_NORMAL, -1);
- }
- return 1;
- }
- stock IsPlayerNearProperty(playerid)
- {
- new Float:Distance;
- for(new i; i < MAX_PROPRIEDADES_SERVIDOR; i++)
- {
- if(DOF2_FileExists(pProp(i)))
- {
- Distance = GetDistanceToProperty(playerid, i);
- if(Distance < 1.0) return i;
- }
- }
- return -666;
- }
- forward Float:GetDistanceToProperty(playerid, Property);
- public Float:GetDistanceToProperty(playerid, Property)
- {
- new Float:CurrentPos[6];
- GetPlayerPos(playerid, CurrentPos[0], CurrentPos[1], CurrentPos[2]);
- CurrentPos[3] = PropInfo[Property][Prop_X];
- CurrentPos[4] = PropInfo[Property][Prop_Y];
- CurrentPos[5] = PropInfo[Property][Prop_Z];
- return floatsqroot(floatpower(floatabs(floatsub(CurrentPos[3],CurrentPos[0])),2)+floatpower(floatabs(floatsub(CurrentPos[4],CurrentPos[1])),2)+floatpower(floatabs(floatsub(CurrentPos[5],CurrentPos[2])),2));
- }
- forward Propriedade_Ganhos(playerid);
- public Propriedade_Ganhos(playerid)
- {
- if(ContarMyProps(playerid) <= 0) return 1;
- new PropStrGanhos[128];
- SendClientMessage(playerid, -1, "{FF0000}[!]{FFFF00}========================[ {FF8000}GANHOS DE SUAS PROPRIEDADES {FFFF00}]========================");
- for(new i = 0; i < MAX_PROPRIEDADES_SERVIDOR; ++i)
- {
- if(DOF2_FileExists(pProp(i)))
- {
- if(!strcmp(DOF2_GetString(pProp(i), "Prop_Dono"), pNamer(playerid)))
- {
- format(PropStrGanhos, sizeof(PropStrGanhos), "{FF0000}[!] {FF0080}%s {FFFFFF}| ID: {00FFFF}%d {FFFFFF}| Ganhos: {00FF00}R$ %d", DOF2_GetString(pProp(i), "Prop_Nome"), i, DOF2_GetInt(pProp(i), "Prop_Ganhando"));
- SendClientMessage(playerid, -1, PropStrGanhos);
- GivePlayerMoney(playerid, DOF2_GetInt(pProp(i), "Prop_Ganhando"));
- DOF2_SetInt(pProp(i), "Prop_AutoSell", DIAS_AUTO_VENDER);
- PropInfo[i][Prop_AutoSell] = DOF2_GetInt(pProp(i), "Prop_AutoSell");
- }
- }
- }
- SendClientMessage(playerid, -1, "{FF0000}[!]{FFFF00}========================[ {FF8000}GANHOS DE SUAS PROPRIEDADES {FFFF00}]========================");
- return 1;
- }
- forward FuncAutoSell();
- public FuncAutoSell()
- {
- for(new i = 0; i < MAX_PROPRIEDADES_SERVIDOR; ++i)
- {
- if(DOF2_FileExists(pProp(i)))
- {
- if(DOF2_GetBool(pProp(i), "Prop_Comprada") == true)
- {
- DOF2_SetInt(pProp(i), "Prop_AutoSell", DOF2_GetInt(pProp(i), "Prop_AutoSell")-3600000);
- PropInfo[i][Prop_AutoSell] = DOF2_GetInt(pProp(i), "Prop_AutoSell");
- if(PropInfo[i][Prop_AutoSell] <= 0)
- {
- DOF2_SetString(pProp(i), "Prop_Dono", "Ninguém");
- DOF2_SetBool(pProp(i), "Prop_Comprada", false);
- DOF2_SetInt(pProp(i), "Prop_AutoSell", DIAS_AUTO_VENDER);
- printf("[AUTO-VENDER] Propriedade ID %d vendida automaticamente.", i);
- CarregarProp(i);
- }
- }
- }
- }
- return 1;
- }
- stock CallViewListInts(playerid)
- {
- IntMaxValue[playerid][0] = IntMaxValue[playerid][2]*10; //Aqui multiplica o MIN do Loop pelo número da página, se por acaso eu estiver na página 2, então: 2*10=20
- IntMaxValue[playerid][1] = IntMaxValue[playerid][2]*10+10; //Aqui multiplica o MAX do Loop pelo número da página e adiciona +10, se por acaso eu estiver na página 2, então: 20*10=20+10=30
- if(IntMaxValue[playerid][1] >= sizeof(_GetIntProps)) IntMaxValue[playerid][1] = sizeof(_GetIntProps);
- new StringDialog[400], Strizs[128];
- for(new i = IntMaxValue[playerid][0]; i < IntMaxValue[playerid][1]; ++i)
- {
- format(Strizs, sizeof(Strizs), "%s\n", _GetIntProps[i][pIntName]);
- strcat(StringDialog, Strizs);
- }
- if(!(IntMaxValue[playerid][1] >= sizeof(_GetIntProps))) strcat(StringDialog, "{FF0080}Próximo >>");
- if(IntMaxValue[playerid][2] <= 0) ShowPlayerDialog(playerid, DIALOG_PROP_INTERIORES, DIALOG_STYLE_LIST, "Lista de Interiores", StringDialog, "Escolher", "Cancelar");
- else ShowPlayerDialog(playerid, DIALOG_PROP_INTERIORES, DIALOG_STYLE_LIST, "Lista de Interiores", StringDialog, "Escolher", "Voltar");
- return 1;
- }
- /*
- stock GetTempProp(PropID)
- {
- new StringTempProp[25];
- if(DOF2_GetInt(pProp(PropID), "Prop_AutoSell") >= 86400000) format(StringTempProp, sizeof(StringTempProp), "%d Dia(s)", DOF2_GetInt(pProp(PropID), "Prop_AutoSell")/86400000);
- else if(DOF2_GetInt(pProp(PropID), "Prop_AutoSell") >= 3600000 && DOF2_GetInt(pProp(PropID), "Prop_AutoSell") < 86400000) format(StringTempProp, sizeof(StringTempProp), "%d Hora(s)", DOF2_GetInt(pProp(PropID), "Prop_AutoSell")/3600000);
- else if(DOF2_GetInt(pProp(PropID), "Prop_AutoSell") >= 60000 && DOF2_GetInt(pProp(PropID), "Prop_AutoSell") < 3600000) format(StringTempProp, sizeof(StringTempProp), "%d Minuto(s)", DOF2_GetInt(pProp(PropID), "Prop_AutoSell")/60000);
- return StringTempProp;
- }
- */
- //----> Comandos
- CMD:aprops(playerid)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Você não tem permissão para usar este comando.");
- RhayID[playerid] = IsPlayerNearProperty(playerid);
- ShowDialogProps(playerid, RhayID[playerid], DIALOG_PROP_ADMIN_HOME);
- return 1;
- }
- CMD:props(playerid)
- {
- Contar_Propriedades();
- if(Propriedades_Criadas <= 0) return SendClientMessage(playerid, 0xFF0000FF, "[ERRO]: Nenhuma propriedade encontrada.");
- Prop_List[playerid][10] = -1;
- ViewListProps(playerid);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement