Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // GM TOPO
- new Casas;
- new CasaPickup[MAX_CASAS];
- new Text3D:CasaTextLabel[MAX_CASAS];
- // COMANDO
- CMD:criarcasa(playerid, params[])
- {
- new File[32], Float:Pos[3];
- if(!IsPlayerAdmin(playerid))
- return SendClientMessage(playerid, -1, "| ERRO | Você não tem permissão!");
- if(sscanf(params, "dd", Preco, Interior)
- return SendClientMessage(playerid, -1, "| ERRO | Use: /CriarCasa [Preço] [Interior]");
- format(File, sizeof(File), "Casas/Casa%d.ini", Casas);
- GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
- if(!DOF2::FileExists(File))
- {
- DOF2::CreateFile(File);
- DOF2::SetString(File, "Dono", "Ninguem");
- DOF2::SetString(File, "Mensagem", "Nada");
- DOF2::SetInt(File, "TDono", 0);
- DOF2::SetInt(File, "Preco", Preco);
- DOF2::SetInt(File, "Interior", Interior);
- DOF2::SetFloat(File, "X", Pos[0]);
- DOF2::SetFloat(File, "Y", Pos[1]);
- DOF2::SetFloat(File, "Z", Pos[2]);
- DOF2::SaveFile();
- }
- CasaPickup[Casas] = CreateDynamicPickup(1273, 1, Pos[0], Pos[1], Pos[2], -1, -1, -1, 100.0);
- format(string, sizeof(string), "Casa id: %d", Casas);
- CasaTextLabel[Casas] = CreateDynamic3DTextLabel(string, -1, Pos[0], Pos[1], Pos[2], 30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100.0);
- SendClientMessage(playerid, -1, "| INFO | Casa criada com sucesso!");
- Casas++;
- return 1;
- }
- CMD:comprarcasa(playerid)
- {
- new File[32];
- for(new House = 0; House < MAX_CASAS; ++House)
- {
- format(File, sizeof(File), "Casas/Casa%d.ini", House);
- if(PlayerToPoint(playerid, 1.0, DOF2::GetFloat(File, "X"), DOF2::GetFloat(File, "Y"), DOF2::GetFloat(File, "Z"))
- return SendClientMessage(playerid, -1, "| ERRO | Você não está em uma Casa!");
- if(GetPlayerMoney(playerid) < DOF2::GetInt(File, "Preco"))
- return SendClientMessage(playerid, -1, "| ERRO | Você não tem dinheiro suficiente!");
- if(DOF2::GetInt(File, "TDono") == 1)
- return SendClientMessage(playerid, -1, "| ERRO | Esta casa já possui um dono(a)!");
- DOF2::SetString(File, "Dono", pNome);
- DOF2::SetInt(File, "TDono", 1);
- // PLAYER
- format(File, sizeof(File, "Contas/%s.ini", pNome);
- DOF2::SetInt(Conta, "CasaID", House);
- DOF2::SaveFile();
- DestroyDynamicPickup(CasaPickup[House]);
- CasaPickup[House] = CreateDynamicPickup(19522, 1, INI_ReadFloat(File, "X"), INI_ReadFloat(File, "Y"), INI_ReadFloat(File, "Z"), -1, -1, -1, 100.0);
- format(string, sizeof(string), "Casa id: %d", House);
- UpdateDynamic3DTextLabelText(CasaTextLabel[House], -1, string);
- return 1;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment