[Ajuda] Comando /comprar para casas
#3

pawn Код:
CMD:comprar(playerid, params[])
{
  new house = GetProxHouse(playerid);
  {
     if(IsPlayerInRangeOfPoint(playerid, 5.0, houseData[house][houseX], houseData[house][houseY], houseData[house][houseZ]))
     {
        new
           Float: X, Float: Y, Float: Z,
           string[260],
           filePath[200],
           alreadyOwner,
           ownerFile[200],
           tenantFile[200],
           logString[128];

        GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
        format(ownerFile, sizeof ownerFile, "LHouse/Donos/%s.txt", playerName);
        format(tenantFile, sizeof tenantFile, "LHouse/Locadores/%s.txt", playerName);
        format(filePath, sizeof filePath, "LHouse/Casas/Casa %d.txt", house);

        if(DOF2_FileExists(ownerFile))
        {
        alreadyOwner = DOF2_GetInt(ownerFile, "houseID");
        GetPlayerPos(playerid, X, Y, Z);
        PlayerPlaySound(playerid, 1085, X, Y, Z);
        format(string, sizeof string, "{F90700}Erro: {FFFFFF}Vocк jб й dono da casa %d! Vocк sу pode ter 1 casa!", alreadyOwner);
        SendClientMessage(playerid, COLOR_ERROR, string);
        return 1;
        }

        if(DOF2_FileExists(tenantFile))
        {
        alreadyOwner = DOF2_GetInt(tenantFile, "houseID");
        GetPlayerPos(playerid, X, Y, Z);
        PlayerPlaySound(playerid, 1085, X, Y, Z);
        format(string, sizeof string, "{F90700}Erro: {FFFFFF}Vocк jб й locador de uma casa %d! Vocк sу pode ter 1 casa!", alreadyOwner);
        SendClientMessage(playerid, COLOR_ERROR, string);
        return 1;
        }
        else if(GetPlayerMoney(playerid) < houseData[house][housePrice])
        {
        GetPlayerPos(playerid, X, Y, Z);
        PlayerPlaySound(playerid, 1085, X, Y, Z);
        SendClientMessage(playerid, COLOR_ERROR, "{F90700}Erro: {FFFFFF}Vocк nгo tem dinheiro o suficiente.");
        return 1;
        }

        format(string, sizeof string, "%s comprou a casa de id %d", playerName, house);
        print(string);
        WriteLog(LOG_HOUSES, string);

        DOF2_CreateFile(ownerFile);
        DOF2_SetInt(ownerFile, "houseID", house);
        DOF2_SetString(filePath, "Dono", playerName, "Informaзхes");
        DOF2_SaveFile();

        format(houseData[house][houseOwner], 24, playerName);
        houseData[house][houseStatus] = DOF2_SetInt(filePath, "Status", 0, "Informaзхes");

        GivePlayerMoney(playerid, -houseData[house][housePrice]);
        SetPlayerPos(playerid, houseData[house][houseIntX], houseData[house][houseIntY], houseData[house][houseIntZ]);
        SetPlayerVirtualWorld(playerid, houseData[house][houseVirtualWorld]);
        SetPlayerInterior(playerid, houseData[house][houseInterior]);

        DestroyDynamicPickup(housePickupIn[house]);
        DestroyDynamicMapIcon(houseMapIcon[house]);
        housePickupIn[house] = CreateDynamicPickup(1272, 23, houseData[house][houseX], houseData[house][houseY], houseData[house][houseZ]);
        houseMapIcon[house] = CreateDynamicMapIcon(houseData[house][houseX], houseData[house][houseY], houseData[house][houseZ], 32, -1, -1, 0, -1, 100.0);

        Update3DText(house);
        PlayerTextDrawShow(playerid, welcome[playerid]);
        SetTimerEx("HideTextdraws", 2000, false, "i", playerid);

        format(logString, sizeof logString, "O jogador %s[%d], comprou a casa %d.", playerName, playerid, house);
        WriteLog(LOG_HOUSES, logString);
        return true;
     }
     else
     {
        SendClientMessage(playerid, -1, "Para comprar uma casa va para uma!");
     }
   }
return 1;
}
}
Tente assim....

@EDIT ERREI O LUGAR DO RETURN
Reply


Messages In This Thread
[Ajuda] Comando /comprar para casas - by Cheleber_Pausini - 01.07.2014, 23:18
Re: [Ajuda] Comando /comprar para casas - by Cheleber_Pausini - 02.07.2014, 00:52
Re: [Ajuda] Comando /comprar para casas - by focaximubh - 02.07.2014, 00:57
Re: [Ajuda] Comando /comprar para casas - by Cheleber_Pausini - 02.07.2014, 01:06
Re: [Ajuda] Comando /comprar para casas - by Cheleber_Pausini - 02.07.2014, 10:27
Re: [Ajuda] Comando /comprar para casas - by Coreia - 02.07.2014, 15:14
Re: [Ajuda] Comando /comprar para casas - by Cheleber_Pausini - 02.07.2014, 22:10

Forum Jump:


Users browsing this thread: 1 Guest(s)